/* ============================================================
   VƯỜN TÂM HỒN · Lớp chuyển động "động mà êm"
   Nguyên tắc: chỉ animate transform/opacity (mượt, không giật).
   Tôn trọng prefers-reduced-motion.
   ============================================================ */

/* ---------- Tôn trọng người dùng tắt chuyển động ---------- */
@media (prefers-reduced-motion: reduce) {
  .float-soft, .sprout, .vth-petal, .shimmer::after, .num-pop,
  .oracle-box.bloom-in { animation: none !important; }
  .grow-garden .sprout { transform: none !important; }
  .oracle-box.bloom-in { transform: none !important; opacity: 1 !important; filter: none !important; }
}

/* ---------- 1. Chạm là phản hồi (tactile) ---------- */
.menu-item, .chip, .ghost-btn, .oracle-card, .gtab, .au-play,
.start, .o-cta, .pay-btn, .modal-btn, [data-tap] {
  transition: transform .14s var(--ease, cubic-bezier(.2,.8,.3,1)), box-shadow .14s ease, background .2s ease;
}
.menu-item:active, .chip:active, .ghost-btn:active, .oracle-card:active,
.gtab:active, .au-play:active, .start:active, .o-cta:active,
.pay-btn:active, .modal-btn:active, [data-tap]:active {
  transform: scale(.96);
}

/* ---------- 2. Hiện ra tuần tự khi đổi màn (JS thêm class) ---------- */
/* WAAPI lo phần stagger; class này chỉ để dự phòng */
.reveal-init { opacity: 0; }

/* ---------- 3. Vật thể "sống" — thở/trôi nhẹ ---------- */
.float-soft { animation: floatSoft 6s ease-in-out infinite; will-change: transform; }
@keyframes floatSoft {
  0%,100% { transform: translateY(0) rotate(0deg); }
  50%     { transform: translateY(-5px) rotate(-1.5deg); }
}

/* ---------- 4. Số đếm tăng — nhịp "pop" nhẹ khi đổi ---------- */
.num-pop { animation: numPop .5s cubic-bezier(.2,1.5,.4,1); }
@keyframes numPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

/* ---------- 5. Cánh hoa ăn mừng ---------- */
.vth-petal-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden;
}
.vth-petal {
  position: absolute; top: -8vh; width: 13px; height: 13px;
  border-radius: 0 100% 0 100%;
  background: var(--p-color, #D8B679);
  opacity: .9;
  animation-name: petalFall; animation-timing-function: cubic-bezier(.4,.1,.5,1);
  animation-fill-mode: forwards;
  will-change: transform, opacity;
}
@keyframes petalFall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  12%  { opacity: .95; }
  100% { transform: translateY(118vh) translateX(var(--drift,0)) rotate(var(--rot,360deg)); opacity: 0; }
}

/* ---------- 6. Khu vườn lớn dần ---------- */
.grow-garden {
  margin-top: 14px; position: relative;
  min-height: 92px; border-radius: 22px;
  padding: 10px 14px 0;
  background:
    radial-gradient(120% 80% at 50% 120%, #d9cba8 0%, transparent 60%),
    linear-gradient(180deg, #FAF9F5 0%, #f0ead9 72%, #d8c8a4 100%);
  border: 1px solid var(--vien);
  overflow: hidden;
  box-shadow: inset 0 -14px 24px -16px rgba(76,59,46,.25);
}
.grow-garden .gg-soil {
  position: absolute; left: 0; right: 0; bottom: 0; height: 22px;
  background: linear-gradient(180deg, #b89b6e, #8d7250);
}
.grow-garden .gg-row {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 7px;
  padding-bottom: 16px; min-height: 56px;
}
.grow-garden .gg-empty {
  position: relative; z-index: 1;
  font-size: 12.5px; color: var(--nau-dat-nhat); font-style: italic;
  padding: 16px 4px 24px;
}
.grow-garden .gg-streak {
  position: absolute; top: 9px; right: 12px; z-index: 2;
  font-size: 11.5px; font-weight: 600; color: var(--nau-go);
  background: rgba(255,255,255,.7); border: 1px solid var(--vien);
  padding: 3px 9px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 4px;
}

/* một mầm cây */
.sprout {
  width: 16px; height: 30px; position: relative; flex: 0 0 auto;
  transform-origin: bottom center;
  animation: sway var(--sw, 4s) ease-in-out infinite;
  animation-delay: var(--sd, 0s);
}
.sprout.pop { animation: sproutGrow .7s cubic-bezier(.2,1.4,.4,1), sway var(--sw,4s) ease-in-out .7s infinite; }
.sprout .stem {
  position: absolute; bottom: 0; left: 50%; width: 2.4px; height: 64%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, var(--xanh-reu-nhat), var(--xanh-reu));
  border-radius: 3px;
}
.sprout .leaf {
  position: absolute; width: 11px; height: 8px;
  background: radial-gradient(circle at 30% 30%, var(--xanh-reu-nhat), var(--xanh-reu));
  border-radius: 0 100% 0 100%;
}
.sprout .leaf.l { left: -2px; bottom: 46%; transform: rotate(-8deg); }
.sprout .leaf.r { right: -2px; bottom: 60%; transform: scaleX(-1) rotate(-8deg); }
.sprout .bud {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 9px; height: 9px; border-radius: 50% 50% 50% 0;
  background: radial-gradient(circle at 35% 30%, var(--vang-sang), var(--vang));
  rotate: 45deg;
}
@keyframes sway {
  0%,100% { transform: rotate(-3deg); }
  50%     { transform: rotate(3deg); }
}
@keyframes sproutGrow {
  0%   { transform: translateY(8px) scaleY(.2); opacity: 0; }
  60%  { opacity: 1; }
  100% { transform: translateY(0) scaleY(1); opacity: 1; }
}

/* ---------- 6b. Nở bung từ trong ra — thông điệp vũ trụ ---------- */
.oracle-box.bloom-in {
  animation: oracleBloom .75s cubic-bezier(.16,1,.3,1) both,
             oracleGlowBurst .95s ease-out both;
  transform-origin: center center;
}
@keyframes oracleBloom {
  0%   { transform: scale(.2); opacity: 0; filter: blur(7px); }
  45%  { opacity: 1; }
  100% { transform: scale(1); opacity: 1; filter: blur(0); }
}
@keyframes oracleGlowBurst {
  0%   { box-shadow: 0 0 0 0 rgba(216,182,121,.55), 0 24px 60px -18px rgba(44,38,30,.65); }
  100% { box-shadow: 0 0 90px 10px rgba(216,182,121,0), 0 24px 60px -18px rgba(44,38,30,.65); }
}

/* ---------- 7. Màn chờ lấp lánh (skeleton) ---------- */
.shimmer {
  position: relative; overflow: hidden;
  background: var(--vien); border-radius: 10px;
  min-height: 14px;
}
.shimmer::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  transform: translateX(-100%);
  animation: shimmerMove 1.3s ease-in-out infinite;
}
@keyframes shimmerMove { 100% { transform: translateX(100%); } }
