/* Cảnh động theo trend "web code tặng quà" (scenes-trend.js) */

/* ---------- chung: tên người nhận lên trên để chừa chỗ cho vật thể 3D ở giữa ---------- */
.sc-text.universe .sc-name, .sc-text.photosphere .sc-name, .sc-text.constellation .sc-name, .sc-text.robot .sc-name { top: 17%; font-size: clamp(16px, 7.5cqmin, 54px); }
.sc-text.universe ~ .sc-bottom, .sc-text.photosphere ~ .sc-bottom, .sc-text.constellation ~ .sc-bottom { bottom: 5cqh; max-height: 22cqh; }

/* ---------- Vũ trụ chữ 3D — Big Bang ---------- */
.uv-space { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.uv-space > * { position: absolute; left: 0; top: 0; opacity: 0; will-change: transform, opacity; transition: opacity .3s; }
.uv-word { white-space: nowrap; font-family: var(--tf); color: #fff; font-size: clamp(13px, 5.6cqmin, 38px); text-shadow: 0 0 .8cqmin var(--accent2), 0 0 2.4cqmin var(--accent), 0 0 5cqmin var(--accent); }
.uv-photo { width: 17cqmin; aspect-ratio: 3 / 4; border-radius: 1.4cqmin; background-size: cover; background-position: center; border: .5cqmin solid rgba(255, 255, 255, .92);
  box-shadow: 0 0 2.4cqmin var(--accent), 0 0 6cqmin color-mix(in srgb, var(--accent) 45%, transparent); display: grid; place-items: center; font-size: 7cqmin; pointer-events: auto; cursor: zoom-in; }
.uv-heart { font-size: clamp(14px, 6cqmin, 40px); color: var(--accent); text-shadow: 0 0 2cqmin var(--accent); }
.uv-hint { position: absolute; left: 50%; top: 60%; transform: translateX(-50%); z-index: 4; color: #fff; font-size: clamp(12px, 3.6cqmin, 18px); letter-spacing: .04em; opacity: .85; white-space: nowrap; pointer-events: none;
  animation: uv-hint 1.8s ease-in-out infinite; transition: opacity .5s; }
.uv-hint.gone { opacity: 0; animation: none; }
@keyframes uv-hint { 50% { opacity: .35; transform: translateX(-50%) translateY(-4px); } }
.uv-flash { position: absolute; inset: 0; z-index: 5; pointer-events: none; background: radial-gradient(circle at 50% 47%, #fff, color-mix(in srgb, var(--accent2) 70%, transparent) 30%, transparent 70%); opacity: 0; }
.uv-flash.on { animation: uv-flash 1.1s ease-out forwards; }
@keyframes uv-flash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }
.cs.scene:not(.uv-banged) .sc-text.universe ~ .sc-bottom { opacity: 0; }
.cs.scene .sc-text.universe ~ .sc-bottom { transition: opacity 1.2s .8s; }

/* ---------- Quả cầu ảnh 3D ---------- */
.ps-scene { position: absolute; inset: 0; z-index: 2; perspective: 900px; pointer-events: none; --ps-r: min(31cqmin, 34cqh); --ps-t: calc(var(--ps-r) * .33); }
.ps-ball { position: absolute; left: 50%; top: 46%; width: 0; height: 0; transform-style: preserve-3d; will-change: transform; }
.ps-tile { position: absolute; left: calc(var(--ps-t) / -2); top: calc(var(--ps-t) / -2); width: var(--ps-t); height: var(--ps-t); transform-style: preserve-3d; }
.ps-face { position: absolute; inset: 0; border-radius: 1cqmin; background-size: cover; background-position: center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: .35cqmin solid rgba(255, 255, 255, .85); box-shadow: 0 0 1.6cqmin color-mix(in srgb, var(--accent) 70%, transparent); display: grid; place-items: center; font-size: 4cqmin; pointer-events: auto; cursor: zoom-in; }
.ps-back { transform: rotateY(180deg); opacity: .4; filter: saturate(.6) brightness(.7); pointer-events: none; }
.ps-core { position: absolute; left: 0; top: 0; font-size: 10cqmin; color: var(--accent); text-shadow: 0 0 2cqmin #fff, 0 0 5cqmin var(--accent), 0 0 10cqmin var(--accent); pointer-events: none; }

/* ---------- Chòm sao kỷ niệm ---------- */
.cn-nodes { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.cn-nodes > * { position: absolute; left: 0; top: 0; will-change: transform, opacity; transition: opacity .3s; }
.cn-photo { width: 12cqmin; aspect-ratio: 1; border-radius: 1.2cqmin; background-size: cover; background-position: center; border: .4cqmin solid #fff; display: grid; place-items: center; font-size: 5cqmin;
  box-shadow: 0 0 0 .5cqmin color-mix(in srgb, var(--accent2) 50%, transparent), 0 0 3cqmin var(--accent); pointer-events: auto; cursor: zoom-in; }
.cn-word { display: flex; align-items: center; gap: 1cqmin; white-space: nowrap; color: #fff; font-family: var(--bf); font-weight: 700; font-size: clamp(11px, 3.4cqmin, 20px); text-shadow: 0 0 1.4cqmin var(--accent); }
.cn-word i { width: 1.4cqmin; height: 1.4cqmin; border-radius: 50%; background: #fff; box-shadow: 0 0 1cqmin #fff, 0 0 2.4cqmin var(--accent2); flex: none; }
.cn-lyric { position: absolute; left: 50%; top: 70%; transform: translate(-50%, -50%); z-index: 4; width: max-content; max-width: 88cqw; text-align: center; color: #fff; font-family: var(--tf); font-size: clamp(16px, 6cqmin, 40px);
  text-shadow: 0 0 1.4cqmin var(--accent), 0 2px 8px rgba(0, 0, 0, .8); opacity: 0; transition: opacity .38s, transform .38s; pointer-events: none; }
.cn-lyric.on { opacity: 1; transform: translate(-50%, -62%); }
.sc-text.constellation ~ .sc-bottom { max-height: 14cqh; }

/* ---------- Bé robot ---------- */
.rb-bot { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); z-index: 3; display: grid; justify-items: center; gap: 4cqmin; cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* đầu robot: màn hình bo tròn viền phát sáng + ăng-ten nhấp nháy (trước đây chỉ có hai mắt trơ trọi, nhìn như lỗi) */
.rb-face { position: relative; padding: 5cqmin 6.5cqmin 6cqmin; border-radius: 7cqmin; background: linear-gradient(160deg, #262640, #0f0f1e); border: .7cqmin solid color-mix(in srgb, var(--rb) 45%, #2b2b40);
  box-shadow: 0 0 5cqmin color-mix(in srgb, var(--rb) 30%, transparent), inset 0 0 3cqmin rgba(0, 0, 0, .65); }
.rb-face::before { content: ""; position: absolute; left: 50%; bottom: 100%; width: .8cqmin; height: 5.5cqmin; translate: -50% 0; background: color-mix(in srgb, var(--rb) 45%, #2b2b40); }
.rb-face::after { content: ""; position: absolute; left: 50%; bottom: calc(100% + 5cqmin); width: 3.6cqmin; height: 3.6cqmin; translate: -50% 0; border-radius: 50%; background: var(--rb); box-shadow: 0 0 2.5cqmin var(--rb); animation: rb-ant 1.6s ease-in-out infinite; }
@keyframes rb-ant { 50% { opacity: .35; } }
.rb-eyes { display: flex; gap: 9cqmin; will-change: transform; }
.rb-eye { width: 19cqmin; height: 19cqmin; transition: transform .12s; transform-origin: 50% 55%; }
.rb-eyes.blink .rb-eye { transform: scaleY(.08); }
.rb-eye svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 1.2cqmin var(--rb)) drop-shadow(0 0 3.5cqmin var(--rb)); }
.rb-sq { fill: var(--rb); transition: opacity .25s, transform .25s; transform-origin: 50% 50%; }
.rb-hap { stroke: var(--rb); opacity: 0; transition: opacity .25s; }
.rb-love { fill: #ff4d8d; opacity: 0; transform: scale(.4); transform-origin: 50% 55%; transition: opacity .25s, transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.rb-bot.happy .rb-sq, .rb-bot.love .rb-sq { opacity: 0; transform: scale(.6); }
.rb-bot.happy .rb-hap { opacity: 1; }
.rb-bot.love .rb-love { opacity: 1; transform: scale(1); animation: rb-beat .9s ease-in-out infinite .35s; }
.rb-bot.love .rb-eye svg { filter: drop-shadow(0 0 1.2cqmin #ff4d8d) drop-shadow(0 0 3.5cqmin #ff4d8d); }
@keyframes rb-beat { 50% { transform: scale(1.12); } }
.rb-blush { position: absolute; left: 0; right: 0; bottom: -3cqmin; display: flex; justify-content: space-between; padding: 0 1cqmin; opacity: 0; transition: opacity .4s; pointer-events: none; }
.rb-blush i { width: 12cqmin; height: 4.5cqmin; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 105, 160, .85), transparent); }
.rb-bot.love .rb-blush, .rb-bot.happy .rb-blush { opacity: 1; }
/* lời robot nằm trong bong bóng thoại (không trống trơn khi đang xoá chữ để gõ câu mới) */
.rb-say { position: relative; display: grid; place-items: center; box-sizing: border-box; min-width: min(46cqmin, 80cqw); min-height: 2.6em; padding: .45em 1em; border-radius: 3cqmin; background: rgba(255, 255, 255, .07); border: 1.5px solid color-mix(in srgb, var(--rb) 55%, transparent); max-width: 86cqw; text-align: center; color: #fff; font: 700 clamp(14px, 5cqmin, 30px)/1.35 'Courier New', ui-monospace, monospace; letter-spacing: .04em; text-shadow: 0 0 1.4cqmin var(--rb); }
.rb-say::before { content: ""; position: absolute; left: 50%; bottom: 100%; translate: -50% 0; border: 1.6cqmin solid transparent; border-bottom-color: color-mix(in srgb, var(--rb) 55%, transparent); }
.rb-say span::after { content: '▍'; margin-left: 2px; color: var(--rb); animation: rb-caret .9s steps(1) infinite; }
@keyframes rb-caret { 50% { opacity: 0; } }
.rb-tip { font: 600 clamp(10px, 2.8cqmin, 14px) system-ui, sans-serif; color: #fff; opacity: .6; transition: opacity .4s; }
.rb-tip.gone { opacity: 0; }
.rb-heart { position: absolute; z-index: 6; font-size: 6cqmin; pointer-events: none; animation: rb-pop 1.5s ease-out forwards; }
@keyframes rb-pop { from { transform: translate(-50%, -50%) scale(.4); } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(30deg); opacity: 0; } }
.cs.static .rb-say span::after { display: none; }

/* ---------- Chồng thư ---------- */
.lt-wrap { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; }
.lt-deck { position: relative; width: min(80cqw, 58cqh); aspect-ratio: 4 / 5; margin-top: -4cqh; }
.lt-card { position: absolute; inset: 0; border-radius: 2.2cqmin; padding: 6cqmin 6cqmin 5cqmin; color: var(--ink); font-family: var(--bf); overflow: hidden; cursor: grab; user-select: none; -webkit-user-select: none;
  background: repeating-linear-gradient(180deg, transparent 0 calc(1.75em - 1px), color-mix(in srgb, var(--accent) 14%, transparent) calc(1.75em - 1px) 1.75em), var(--paper, #fffaf7);
  box-shadow: 0 1.4cqmin 4cqmin rgba(0, 0, 0, .18), 0 .2cqmin .6cqmin rgba(0, 0, 0, .1); border: 1px solid color-mix(in srgb, var(--accent) 18%, #fff);
  transform: translateY(calc(var(--k, 0) * 1.6cqmin)) scale(calc(1 - var(--k, 0) * .035)) rotate(var(--rot)); transition: transform .45s cubic-bezier(.3, .7, .3, 1); font-size: clamp(12px, 3.9cqmin, 19px); line-height: 1.75; }
.lt-card:active { cursor: grabbing; }
.lt-card.gone { opacity: 0; pointer-events: none; visibility: hidden; }
.lt-card.cover { background: linear-gradient(160deg, var(--paper, #fff), color-mix(in srgb, var(--accent2) 45%, #fff)); }
.lt-stamp { position: absolute; right: 4cqmin; top: 4cqmin; width: 10cqmin; aspect-ratio: 4 / 5; display: grid; place-items: center; font-size: 5cqmin; border: .4cqmin dashed color-mix(in srgb, var(--accent) 55%, #fff); border-radius: .6cqmin; background: #fff; transform: rotate(6deg); }
.lt-no { position: absolute; left: 5cqmin; bottom: 3cqmin; font: 700 clamp(9px, 2.6cqmin, 12px) system-ui, sans-serif; opacity: .45; letter-spacing: .08em; }
.lt-hi { font-family: var(--tf); color: var(--accent); font-size: clamp(24px, 9cqmin, 52px); line-height: 1.15; margin-bottom: .2em; max-width: 100%; overflow-wrap: anywhere; }
.lt-hi.sm { font-size: clamp(20px, 7cqmin, 40px); }
.lt-cover { height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 1.6cqmin; padding: 0 4cqmin; }
.lt-cover p { margin: 0; opacity: .8; }
.lt-cover small { opacity: .6; font-size: .8em; }
.lt-seal { width: 15cqmin; aspect-ratio: 1; margin: 2cqmin auto 0; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 7cqmin; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 60%, #fff), var(--accent) 60%, color-mix(in srgb, var(--accent) 70%, #000));
  box-shadow: inset 0 0 0 .8cqmin color-mix(in srgb, var(--accent) 80%, #000), 0 .6cqmin 1.4cqmin rgba(0, 0, 0, .25); }
.lt-body { height: 100%; overflow-y: auto; scrollbar-width: none; padding-right: 8cqmin; }
.lt-body::-webkit-scrollbar { display: none; }
.lt-body p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.lt-body ul { margin: .4em 0 0; padding: 0; list-style: none; display: grid; gap: .3em; }
.lt-body li::before { content: '♥'; color: var(--accent); margin-right: .5em; }
.lt-ph { position: relative; float: right; width: 34%; margin: .3em 0 .6em 1em; padding: 1.2cqmin 1.2cqmin 3cqmin; background: #fff; box-shadow: 0 .6cqmin 1.6cqmin rgba(0, 0, 0, .2); transform: rotate(4deg); }
.lt-ph img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.lt-tape { position: absolute; left: 50%; top: -1.6cqmin; width: 46%; height: 3.4cqmin; transform: translateX(-50%) rotate(-4deg); background: color-mix(in srgb, var(--accent2) 65%, rgba(255, 255, 255, .6)); opacity: .85; }
.lt-end { text-align: center; padding-right: 0; display: grid; align-content: center; justify-items: center; }
.lt-end .lt-ph { float: none; width: 46%; margin: 0 0 1em; transform: rotate(-3deg); }
.lt-from { font-family: var(--tf); font-size: 1.6em; color: var(--accent); }
.lt-tip { position: absolute; left: 50%; bottom: max(9cqh, 46px); transform: translateX(-50%); white-space: nowrap; font: 600 clamp(11px, 3.2cqmin, 15px) system-ui, sans-serif; color: var(--ink); opacity: .65; transition: opacity .4s; pointer-events: none; }
.lt-tip.gone { opacity: 0; }
.lt-again { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.9); padding: 12px 22px; border-radius: 999px; border: 0; background: var(--accent); color: #fff; font: 700 15px system-ui, sans-serif; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); opacity: 0; pointer-events: none; transition: opacity .4s .3s, transform .4s .3s; }
.lt-wrap.done .lt-again { opacity: 1; transform: translate(-50%, -50%); pointer-events: auto; }
.lt-float { position: absolute; bottom: -8cqh; z-index: 1; color: var(--accent); opacity: .35; font-size: 5cqmin; pointer-events: none; animation: lt-float linear infinite; }
@keyframes lt-float { to { transform: translateY(-120cqh) rotate(200deg); } }
.cs.static .lt-float, .cs.static .lt-tip { display: none; }

@media (prefers-reduced-motion: reduce) { .rb-bot.love .rb-love { animation: none; } .uv-hint { animation: none; } }

/* ---------- Đêm Halloween (haunted) ---------- */
.sc-text.haunted .sc-name { top: 17%; font-size: clamp(18px, 9cqmin, 66px); letter-spacing: .02em; }
.sc-text.haunted ~ .sc-bottom { bottom: 4cqh; max-height: 19cqh; }
.hn-ghost { position: absolute; z-index: 4; width: 12cqmin; max-width: 92px; display: flex; flex-direction: column; align-items: center; gap: .6cqmin; pointer-events: none;
  transform: translate(-50%, -50%); animation: hn-rise 4.2s cubic-bezier(.25, .8, .35, 1) forwards; filter: drop-shadow(0 0 1.6cqmin rgba(255, 255, 255, .55)); }
.hn-ghost svg { width: 100%; height: auto; animation: hn-wobble .9s ease-in-out infinite alternate; }
.hn-ghost span { max-width: 44cqw; text-align: center; line-height: 1.25; font-family: var(--bf); font-weight: 700; font-size: clamp(11px, 3.6cqmin, 22px); color: #fff;
  text-shadow: 0 0 1cqmin var(--accent), 0 0 3cqmin var(--accent), 0 1px 4px rgba(0, 0, 0, .7); }
@keyframes hn-rise {
  0% { transform: translate(-50%, -30%) scale(.2); opacity: 0; }
  14% { transform: translate(-50%, -60%) scale(1.08); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% - 38cqh)) scale(.85); opacity: 0; }
}
@keyframes hn-wobble { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
.hn-tip { position: absolute; left: 50%; top: 41%; transform: translateX(-50%); z-index: 4; padding: .9cqmin 2.6cqmin; border-radius: 999px; background: rgba(0, 0, 0, .38);
  color: #fff; font: 600 clamp(11px, 3.2cqmin, 16px) var(--bf); white-space: nowrap; pointer-events: none; backdrop-filter: blur(4px); animation: hn-tip 2s ease-in-out infinite alternate; transition: opacity .5s; }
.hn-tip.gone { opacity: 0; }
@keyframes hn-tip { to { transform: translateX(-50%) translateY(-.6cqmin); } }
@media (prefers-reduced-motion: reduce) { .hn-ghost svg, .hn-tip { animation: none; } }
