  :root {
      --cream: #fdf6ec;
      --rose: #c97b84;
      --rose-deep: #9e5060;
      --gold: #d4a843;
      --gold-light: #f0cc7a;
      --green: #4a7c59;
      --green-dark: #2d5040;
      --brown: #6b4226;
      --text: #3a2a1e;
      --text-light: #7a5c4a;
  }

  * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
  }

  body {
      background: var(--cream);
      min-height: 100vh;
      overflow: hidden;
      font-family: 'Cormorant Garamond', serif;
      color: var(--text);
  }

  /* Subtle paper texture */
  body::before {
      content: '';
      position: fixed;
      inset: 0;
      background-image:
          radial-gradient(ellipse at 20% 80%, rgba(201, 123, 132, 0.08) 0%, transparent 50%),
          radial-gradient(ellipse at 80% 20%, rgba(212, 168, 67, 0.08) 0%, transparent 50%);
      pointer-events: none;
      z-index: 0;
  }

  /* ── SCENE CONTAINERS ─────────────────────────────── */
  #flower-title {
      text-align: center;
      width: 100%;
  }

  .hint-text {
      text-align: center;
      width: 100%;
      font-size: 0.75rem;
      color: #999;
      margin-top: -20px;
  }

  #scene-flower {
      position: fixed;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2rem;
      z-index: 10;
      transition: opacity 0.8s ease;
  }

  #scene-tree {
      position: fixed;
      inset: 0;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      z-index: 10;
      opacity: 0;
      pointer-events: none;
  }

  #scene-final {
      position: fixed;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      padding-left: 8vw;
      z-index: 5;
      opacity: 0;
      pointer-events: none;
  }

  /* ── FLOWER ───────────────────────────────────────── */
  #flower-wrap {
      cursor: default;
      transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
      position: relative;
      width: 180px;
      height: 180px;
  }

  #flower-wrap:hover {
      cursor: pointer;
      transform: scale(1.25);
  }

  #flower-wrap.clicked {
      animation: flowerSpin 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  @keyframes flowerSpin {
      0% {
          transform: scale(1.25) rotate(0deg);
          opacity: 1;
      }

      60% {
          transform: scale(1.1) rotate(360deg);
          opacity: 0.8;
      }

      100% {
          transform: scale(0) rotate(720deg);
          opacity: 0;
      }
  }

  .flower-svg {
      width: 100%;
      height: 100%;
      filter: drop-shadow(0 8px 24px rgba(158, 80, 96, 0.25));
  }

  /* Petal animation on hover */
  /* #flower-wrap:hover .petal-outer {
      transform: translateY(-17px);
      animation: petalBreath .9s ease-in-out infinite alternate;
  }

  #flower-wrap:hover .petal-inner {
      transform: translateY(-17px);
      animation:  petalBreathInner .9s ease-in-out infinite alternate;
  } */

  @keyframes petalBreath {
      from {
          transform: translateY(-27px);
      }

      to {
          transform: translateY(-44px);
      }
  }

  @keyframes petalBreathInner {
      from {
          transform: translateY(-27px);
      }

      to {
          transform: translateY(-32px);
      }
  }

  @keyframes petalPulse {
      from {
          transform-origin: center;
      }

      to {
          filter: brightness(1.15) saturate(1.2);
      }
  }

  .petal-outer {
      transform: translateY(-33px);
      animation: petalBreath .9s ease-in-out infinite alternate;
  }

  .petal-inner {
      transform: translateY(-33px);
      animation: petalBreathInner .9s ease-in-out infinite alternate;
  }


  #flower-title {
      font-family: 'Cinzel', serif;
      font-weight: 300;
      font-size: clamp(1.4rem, 3.5vw, 2.2rem);
      letter-spacing: 0.35em;
      color: var(--rose-deep);
      text-transform: uppercase;
      opacity: 0;
      animation: fadeUp 1.4s ease 0.6s forwards;
  }

  @keyframes fadeUp {
      from {
          opacity: 0;
          transform: translateY(16px);
      }

      to {
          opacity: 1;
          transform: translateY(0);
      }
  }

  .flower-wrap-appear {
      opacity: 0;
      animation: fadeUp 1.2s ease 0.2s forwards;
  }

  /* ── TREE SCENE ───────────────────────────────────── */
  #tree-container {
      position: relative;
      width: 100vw;
      height: 100vh;
      display: flex;
      align-items: flex-end;
      justify-content: center;
  }

  #tree-svg {
      position: absolute;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: min(480px, 90vw);
      height: auto;
  }

  /* Ground line */
  #ground {
      position: absolute;
      bottom: 0;
      width: 100%;
      height: 2px;
      background: linear-gradient(90deg, transparent, var(--brown), transparent);
  }

  /* ── TREE SVG DRAW ANIMATIONS ─────────────────────── */
  .trunk-path {
      stroke-dasharray: 600;
      stroke-dashoffset: 600;
      animation: drawLine 1.4s ease forwards;
  }

  .branch {
      stroke-dasharray: 400;
      stroke-dashoffset: 400;
  }

  .branch-1 {
      animation: drawLine 0.7s ease 1.2s forwards;
  }

  .branch-2 {
      animation: drawLine 0.7s ease 1.4s forwards;
  }

  .branch-3 {
      animation: drawLine 0.6s ease 1.6s forwards;
  }

  .branch-4 {
      animation: drawLine 0.6s ease 1.7s forwards;
  }

  .branch-5 {
      animation: drawLine 0.6s ease 1.9s forwards;
  }

  .branch-6 {
      animation: drawLine 0.6s ease 2.0s forwards;
  }

  .branch-7 {
      animation: drawLine 0.5s ease 2.1s forwards;
  }

  .branch-8 {
      animation: drawLine 0.5s ease 2.2s forwards;
  }

  .branch-9 {
      animation: drawLine 0.5s ease 2.3s forwards;
  }

  .branch-10 {
      animation: drawLine 0.5s ease 2.3s forwards;
  }

  .branch-11 {
      animation: drawLine 0.45s ease 1.9s forwards;
  }

  .branch-12 {
      animation: drawLine 0.45s ease 2.0s forwards;
  }

  .branch-13 {
      animation: drawLine 0.45s ease 2.0s forwards;
  }

  .branch-14 {
      animation: drawLine 0.45s ease 2.1s forwards;
  }

  .branch-15 {
      animation: drawLine 0.4s ease 2.1s forwards;
  }

  .branch-16 {
      animation: drawLine 0.4s ease 2.2s forwards;
  }

  .branch-17 {
      animation: drawLine 0.4s ease 2.2s forwards;
  }

  .branch-18 {
      animation: drawLine 0.4s ease 2.3s forwards;
  }

  .branch-19 {
      animation: drawLine 0.4s ease 2.3s forwards;
  }

  .branch-20 {
      animation: drawLine 0.4s ease 2.4s forwards;
  }

  .branch-21 {
      animation: drawLine 0.4s ease 2.4s forwards;
  }

  .branch-22 {
      animation: drawLine 0.4s ease 2.5s forwards;
  }

  .branch-23 {
      animation: drawLine 0.35s ease 2.5s forwards;
  }

  .branch-24 {
      animation: drawLine 0.35s ease 2.6s forwards;
  }

  .branch-25 {
      animation: drawLine 0.35s ease 2.6s forwards;
  }

  .branch-26 {
      animation: drawLine 0.35s ease 2.7s forwards;
  }

  .branch-27 {
      animation: drawLine 0.8s ease 1.0s forwards;
  }

  /* Ramas principales nuevas — aparecen primero */
  .branch-27 {
      animation: drawLine 0.8s ease 1.0s forwards;
  }

  .branch-28 {
      animation: drawLine 0.8s ease 1.0s forwards;
  }

  .branch-29 {
      animation: drawLine 0.75s ease 1.1s forwards;
  }

  .branch-30 {
      animation: drawLine 0.75s ease 1.1s forwards;
  }

  /* Sub-ramas de las nuevas — aparecen justo después de su rama madre */
  .branch-31 {
      animation: drawLine 0.5s ease 1.8s forwards;
  }

  .branch-32 {
      animation: drawLine 0.5s ease 1.9s forwards;
  }

  .branch-33 {
      animation: drawLine 0.45s ease 2.0s forwards;
  }

  .branch-34 {
      animation: drawLine 0.5s ease 1.8s forwards;
  }

  .branch-35 {
      animation: drawLine 0.5s ease 1.9s forwards;
  }

  .branch-36 {
      animation: drawLine 0.45s ease 2.0s forwards;
  }

  .branch-37 {
      animation: drawLine 0.45s ease 1.9s forwards;
  }

  .branch-38 {
      animation: drawLine 0.45s ease 2.0s forwards;
  }

  .branch-39 {
      animation: drawLine 0.4s ease 2.1s forwards;
  }

  .branch-40 {
      animation: drawLine 0.45s ease 1.9s forwards;
  }

  .branch-41 {
      animation: drawLine 0.45s ease 2.0s forwards;
  }

  .branch-42 {
      animation: drawLine 0.4s ease 2.1s forwards;
  }

  @keyframes drawLine {
      to {
          stroke-dashoffset: 0;
      }
  }

  /* Yellow flowers blooming */
  .tree-flower {
      opacity: 0;
      transform-origin: center;
      transform: scale(0);
  }

  .tree-flower.bloom {
      animation: bloomFlower 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  }

  @keyframes bloomFlower {
      0% {
          opacity: 0;
          transform: scale(0) rotate(-30deg);
      }

      70% {
          opacity: 1;
          transform: scale(1.2) rotate(5deg);
      }

      100% {
          opacity: 1;
          transform: scale(1) rotate(0deg);
      }
  }

  /* ── FINAL TEXT ───────────────────────────────────── */
  .final-text-block {
      max-width: 480px;
  }

  .final-line1 {
      font-family: 'Cormorant Garamond', serif;
      font-style: italic;
      font-weight: 300;
      font-size: clamp(1.5rem, 3.5vw, 2.4rem);
      color: var(--text);
      line-height: 1.3;
      opacity: 0;
      transform: translateY(20px);
      transition: opacity 0.9s ease, transform 0.9s ease;
  }

  .final-line2 {
      margin-top: 1rem;
      font-family: 'Cinzel', serif;
      font-weight: 300;
      font-size: clamp(1rem, 2.2vw, 1.5rem);
      color: var(--rose-deep);
      letter-spacing: 0.08em;
      line-height: 1.6;
      opacity: 0;
      transform: translateY(20px);
      transition: opacity 0.9s ease 0.4s, transform 0.9s ease 0.4s;
  }

  .final-line3 {
      margin-top: 12px;
      font-family: 'Cormorant Garamond', serif;
      font-style: italic;
      font-weight: 300;
      font-size: clamp(1.5rem, 3.5vw, 2.4rem);
      color: rebeccapurple;
      line-height: 1.3;
      opacity: 0;
      transform: translateY(20px);
      transition: opacity 0.9s ease 0.7s, transform 0.9s ease 0.7s;
  }

  .final-line1.show,
  .final-line2.show,
  .final-line3.show {
      opacity: 1;
      transform: translateY(0);
  }

  #counter {
      display: block;
      margin-top: 0.3rem;
      font-size: clamp(1.1rem, 2.5vw, 1.7rem);
      color: var(--gold);
      font-family: 'Cormorant Garamond', serif;
      font-weight: 400;
  }

  /* ── TREE SLIDE ANIMATION ─────────────────────────── */
  #tree-svg.slide-right {
      animation: slideTreeRight 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  @keyframes slideTreeRight {
      from {
          left: 50%;
          transform: translateX(-50%);
      }

      to {
          left: 72%;
          transform: translateX(-50%);
      }
  }

  @media (max-width: 850px) {
      #scene-final {

          padding-bottom: 450px;
          /* z-index: 15; por encima del árbol */
      }
  }
  /* ── SUBTÍTULOS DE LA CANCIÓN ─────────────────────── */
  .final-line3.lyrics {
      position: relative;
      margin-top: 1.4rem;
      padding: 0.9rem 0 0.2rem 1.1rem;
      min-height: 5.4em;
      font-size: 1rem;
      border-left: 2px solid rgba(212, 168, 67, 0.55);
  }

  .final-line3.lyrics::before {
      content: '♪';
      position: absolute;
      left: -0.62rem;
      top: -0.15rem;
      width: 1.2rem;
      text-align: center;
      font-family: 'Cormorant Garamond', serif;
      font-style: normal;
      font-size: 1.1rem;
      color: var(--gold);
      background: var(--cream);
      animation: notaFlota 2.4s ease-in-out infinite;
  }

  @keyframes notaFlota {
      0%, 100% { transform: translateY(0); opacity: 0.75; }
      50%      { transform: translateY(-4px); opacity: 1; }
  }

  .lyric-current,
  .lyric-next {
      transition: opacity 0.28s ease, transform 0.28s ease;
  }

  .lyric-current {
      font-family: 'Cormorant Garamond', serif;
      font-style: italic;
      font-weight: 400;
      font-size: clamp(1.35rem, 2.9vw, 2.1rem);
      line-height: 1.25;
      color: rebeccapurple;
      text-wrap: balance;
  }

  .lyric-next {
      margin-top: 0.45rem;
      font-family: 'Cormorant Garamond', serif;
      font-style: italic;
      font-weight: 300;
      font-size: clamp(1rem, 1.9vw, 1.3rem);
      line-height: 1.3;
      color: var(--text-light);
      opacity: 0.55;
  }

  .final-line3.lyrics.swap .lyric-current {
      opacity: 0;
      transform: translateY(-6px);
  }

  .final-line3.lyrics.swap .lyric-next {
      opacity: 0;
  }

  .final-line3.lyrics.empty::before {
      opacity: 0.4;
      animation: none;
  }

  @media (max-width: 850px) {
      .final-line3.lyrics {
          margin-top: 1rem;
          min-height: 5em;
      }
  }

  @media (max-width: 480px) {
      .final-text-block {
          max-width: 100%;
          padding-right: 6vw;
      }

      .lyric-current {
          font-size: 1.3rem;
      }

      .lyric-next {
          font-size: 1rem;
      }
  }

  /* Panel del modo ?sync (solo visible al sincronizar) */
  #sync-panel {
      position: fixed;
      right: 12px;
      bottom: 12px;
      z-index: 9999;
      max-width: 280px;
      padding: 10px 14px;
      border-radius: 10px;
      background: rgba(58, 42, 30, 0.88);
      color: var(--cream);
      font: 14px/1.4 system-ui, sans-serif;
  }

  #sync-panel button {
      margin-top: 8px;
      padding: 6px 10px;
      border: 0;
      border-radius: 6px;
      background: var(--gold);
      color: var(--text);
      cursor: pointer;
  }
