/* Thiệp hoạt hình kể chuyện (toon.js) — mọi kích thước theo khung thiệp (cq units) */
.cs.tn-stage { background: var(--page); font-family: var(--bf); }
.tn-bg, .tn-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tn-bg { z-index: 0; }
.tn-fx { z-index: 5; }
.tn-fx > * { pointer-events: auto; }
.tn-fx > .tn-fall { pointer-events: none; }
/* khung diễn: giữa màn, không rộng quá 3:4 để bố cục giống nhau trên điện thoại và máy tính */
.tn-world { position: absolute; top: 0; bottom: 0; left: 50%; width: min(100cqw, 78cqh); translate: -50% 0; z-index: 2; }

/* ---------- trời & đất ---------- */
.tn-ground, .tn-hill { position: absolute; bottom: 0; background: var(--gr); }
.tn-ground { left: -15%; right: -15%; border-radius: 50% 50% 0 0 / 5cqh 5cqh 0 0; box-shadow: inset 0 1.2cqh 0 rgba(255, 255, 255, .22); }
.tn-hill { left: -25%; width: 75%; border-radius: 50% 50% 0 0; background: color-mix(in srgb, var(--gr) 72%, #fff); opacity: .85; }
.tn-sun { position: absolute; width: 15cqmin; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle, #fff9db 0 30%, #ffe066 55%, #fcc419); box-shadow: 0 0 5cqmin rgba(255, 212, 59, .8), 0 0 12cqmin rgba(255, 224, 102, .5); animation: tn-sun 6s ease-in-out infinite; }
.tn-sun.low { width: 26cqmin; background: radial-gradient(circle, #fff4e6 0 25%, #ffc078 55%, #ff922b); box-shadow: 0 0 10cqmin rgba(255, 146, 43, .7); }
@keyframes tn-sun { 50% { box-shadow: 0 0 7cqmin rgba(255, 212, 59, .9), 0 0 16cqmin rgba(255, 224, 102, .55); } }
.tn-moon { position: absolute; width: 11cqmin; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; box-shadow: inset -3cqmin 1.4cqmin 0 0 #fff3bf; filter: drop-shadow(0 0 2.4cqmin rgba(255, 243, 191, .75)); rotate: -18deg; }
.tn-night .tn-moon { left: 80%; top: 13%; }
.tn-stars { position: absolute; inset: 0; }
.tn-stars i { position: absolute; width: calc(.55cqmin * var(--z)); aspect-ratio: 1; border-radius: 50%; background: #fff; box-shadow: 0 0 1cqmin #fff; animation: tn-twk 2.6s ease-in-out infinite; }
@keyframes tn-twk { 50% { opacity: .25; transform: scale(.6); } }
.tn-night { position: absolute; inset: 0; opacity: 0; background: linear-gradient(180deg, #0b1437, #24326b 70%, #2e3d78); }
.tn-dim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(52, 58, 64, .55), rgba(73, 80, 87, .25)); }
.tn-drift { animation: tn-drift 9s ease-in-out infinite alternate; }
@keyframes tn-drift { to { transform: translateX(6cqmin); } }
.tn-wide { width: calc(var(--w) * 1%) !important; height: calc(var(--h, 20) * 1cqh); }
.tn-wide > svg { width: 100%; height: 100% !important; }
.tn-season { position: absolute; inset: 0; }
.tn-season.spring { background: linear-gradient(180deg, #ffdeeb, #fff0f6 60%); }
.tn-season.summer { background: linear-gradient(180deg, #74c0fc, #d0ebff 60%); }
.tn-season.autumn { background: linear-gradient(180deg, #ffc078, #fff4e6 60%); }
.tn-season.winter { background: linear-gradient(180deg, #ced4da, #f1f3f5 60%); }
.tn-bunting { position: absolute; left: 0; right: 0; top: 0; height: 7cqh; border-top: .5cqmin solid #c9a9a6;
  background: conic-gradient(from -30deg at 50% 100%, #ff8787 0 60deg, transparent 0) 0 0 / 14cqmin 100% repeat-x,
    conic-gradient(from -30deg at 50% 100%, #ffd43b 0 60deg, transparent 0) 7cqmin 0 / 14cqmin 100% repeat-x; }

/* sông, bờ (người lái đò) */
.tn-river { position: absolute; left: 0; right: 0; top: 60%; bottom: 0; background: linear-gradient(180deg, #74c0fc, #1c7ed6); }
.tn-river::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 6cqmin, rgba(255, 255, 255, .45) 6cqmin 9cqmin, transparent 9cqmin 16cqmin) 0 2cqh / 32cqmin 1cqh no-repeat repeat-x; background-repeat: repeat; background-size: 32cqmin 5cqh; opacity: .55; animation: tn-wave 3s linear infinite; }
@keyframes tn-wave { to { background-position: 32cqmin 0; } }
.tn-bank { position: absolute; top: 58%; bottom: 0; width: 28%; background: var(--gr); z-index: 1; }
.tn-bank.l { left: -6%; border-radius: 0 60% 0 0 / 0 12% 0 0; }
.tn-bank.r { right: -6%; border-radius: 60% 0 0 0 / 12% 0 0 0; }
.tn-boat { position: absolute; top: 54%; width: 40cqmin; height: 22cqmin; translate: -50% 0; z-index: 3; }
.tn-boat.go { animation: tn-rock 1.6s ease-in-out infinite; }
.tn-boat.back > .tn-p { transform: scaleX(-1); }
@keyframes tn-rock { 50% { transform: translateY(.8cqmin) rotate(1.5deg); } }
.tn-oar { transform-origin: 50% 10%; rotate: 25deg; }
.tn-oar.row { animation: tn-row 1.1s ease-in-out infinite; }
@keyframes tn-row { 50% { rotate: -25deg; } }

/* thác & vũ môn (cá chép) */
.tn-cliff { position: absolute; top: 14%; bottom: 26%; width: 30%; background: linear-gradient(180deg, #82c91e 0 2.6cqh, #a08c76 2.6cqh, #7a6654); }
.tn-cliff.l { left: 0; border-radius: 0 3cqmin 0 0; }
.tn-cliff.r { right: 0; border-radius: 3cqmin 0 0 0; }
.tn-wfall { position: absolute; left: 50%; translate: -50% 0; top: 14%; height: 62%; width: 30cqmin; border-radius: 1cqmin; opacity: .92;
  background: repeating-linear-gradient(180deg, #a5d8ff 0 3cqh, #e7f5ff 3cqh 4cqh, #74c0fc 4cqh 7cqh); background-size: 100% 7cqh; animation: tn-flow .5s linear infinite; }
@keyframes tn-flow { to { background-position: 0 7cqh; } }
.tn-pool { position: absolute; left: -10%; right: -10%; top: 72%; bottom: 0; background: linear-gradient(180deg, #4dabf7, #1864ab); border-radius: 50% 50% 0 0 / 4cqh 4cqh 0 0; }
.tn-flash { position: absolute; inset: 0; background: radial-gradient(circle, #fff, #fff3bf 60%, rgba(255, 243, 191, 0)); opacity: 0; pointer-events: none; }

/* cây có tổ chim */
.tn-trunk { position: absolute; left: 4%; width: 13%; top: 30%; height: 40%; background: linear-gradient(90deg, #7f5539, #a47148); border-radius: 2cqmin 2cqmin 0 0; z-index: 1; }
.tn-branch { position: absolute; left: 10%; width: 52%; top: 50.5%; height: 2.6cqmin; background: #8d6346; border-radius: 99px; rotate: -3deg; transform-origin: left; z-index: 1; }
.tn-leaves { position: absolute; left: -12%; width: 46%; top: 8%; height: 30%; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #8ce99a, #51cf66 70%); box-shadow: 14cqmin 4cqmin 0 -2cqmin #69db7c; z-index: 1; }

/* ---------- nhân vật ---------- */
.tn-a { position: absolute; width: calc(var(--s) * 1cqmin); aspect-ratio: 1; translate: -50% -100%; transform-origin: 50% 100%; z-index: 3; }
.tn-f { position: absolute; inset: 0; }
.tn-a.flip > .tn-f { transform: scaleX(-1); }
.tn-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; display: block; }
.tn-svg .tn-body { transform-box: view-box; transform-origin: 50px 98px; animation: tn-breathe 2.6s ease-in-out infinite; }
@keyframes tn-breathe { 50% { transform: scale(1.02, .975); } }
.tn-a.walk .tn-body { animation: tn-hop .32s ease-in-out infinite alternate; }
@keyframes tn-hop { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-5px) rotate(4deg); } }
.tn-a.climb .tn-body { animation: tn-climb .4s ease-in-out infinite alternate; }
@keyframes tn-climb { from { transform: rotate(-6deg); } to { transform: translateY(-3px) rotate(6deg); } }
.tn-a.crawl .tn-body { animation: tn-crawl .9s ease-in-out infinite; }
@keyframes tn-crawl { 50% { transform: scale(1.08, .94); } }
.tn-a.shiver > .tn-f > .tn-svg { animation: tn-shiver .13s linear infinite alternate; }
@keyframes tn-shiver { from { transform: translateX(-1.5%); } to { transform: translateX(1.5%); } }
.tn-open { transform-box: fill-box; transform-origin: center; animation: tn-blink 4.6s infinite var(--bd, 0s); }
@keyframes tn-blink { 0%, 93%, 100% { transform: none; } 96% { transform: scaleY(.1); } }
.tn-eyes circle { fill: #33262a; }
.tn-eyes .tn-hl { fill: #fff; }
.tn-svg .tn-happy, .tn-svg .tn-shut, .tn-svg .tn-mouth { fill: none; stroke: #3b2a2a; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.tn-happy, .tn-shut, .tn-tear, .tn-o { opacity: 0; transition: opacity .2s; }
.tn-tear { fill: #74c0fc; }
.tn-o { fill: #3b2a2a; }
.tn-blush ellipse { fill: #ff8fa3; }
.tn-blush { opacity: .45; transition: opacity .3s; }
.tn-a.happy .tn-open, .tn-a.sleep .tn-open { opacity: 0; }
.tn-a.happy .tn-happy, .tn-a.sleep .tn-shut { opacity: 1; }
.tn-a.shy .tn-blush, .tn-a.happy .tn-blush { opacity: .95; }
.tn-a.sad .tn-tear { opacity: 1; animation: tn-tear 1.4s ease-in infinite; }
@keyframes tn-tear { from { transform: translateY(0); } to { transform: translateY(6px); opacity: 0; } }
.tn-a.wow .tn-mouth { opacity: 0; }
.tn-a.wow .tn-o { opacity: 1; }
.tn-arm { transform-box: fill-box; transform-origin: 50% 12%; transition: transform .35s; }
.tn-a.hold .tn-arm.r { transform: rotate(-70deg); }
.tn-a.up .tn-arm.r { transform: rotate(-155deg); }
.tn-a.wave .tn-arm.r { animation: tn-wavearm .42s ease-in-out infinite alternate; }
@keyframes tn-wavearm { from { transform: rotate(-120deg); } to { transform: rotate(-168deg); } }
.tn-tail { transform-box: fill-box; transform-origin: 85% 90%; animation: tn-wag 1.8s ease-in-out infinite alternate; }
@keyframes tn-wag { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
.tn-wing { transform-box: view-box; transform-origin: 46px 62px; transition: transform .45s; }
.tn-a.spread .tn-wing { transform: rotate(-38deg) scale(1.6, 1.4); }
.tn-a.fly .tn-wing { animation: tn-flap .16s ease-in-out infinite alternate; }
.tn-a.fly .tn-body { animation: none; }
@keyframes tn-flap { from { transform: rotate(-50deg) scale(1.3); } to { transform: rotate(20deg); } }
.tn-spikes { transition: fill .5s, stroke .5s, transform .35s; transform-box: view-box; transform-origin: 50px 60px; }
.tn-a.bristle .tn-spikes { transform: scale(1.14); }
.tn-a.soft .tn-spikes { fill: #ffa8c5; stroke: #ffa8c5; transform: scale(.94); }
/* cá chép */
.tn-a.swim .tn-tail { animation-duration: .5s; }
.tn-horn { opacity: 0; transition: opacity .6s; }
.tn-a.gold .tn-horn { opacity: 1; }
.tn-a.gold .tn-svg { filter: sepia(1) saturate(4.5) hue-rotate(-12deg) brightness(1.12) drop-shadow(0 0 2.4cqmin #ffd43b); }
.tn-a.charge .tn-svg { animation: tn-charge .45s ease-in-out infinite alternate; }
@keyframes tn-charge { to { filter: drop-shadow(0 0 2.5cqmin #fff3bf) brightness(1.25); } }
.tn-a.soar > .tn-f { animation: tn-soar 3s ease-in-out infinite; }
@keyframes tn-soar { 50% { transform: translateY(-3cqmin) rotate(-4deg); } }
/* bong bóng thoại, zzz */
.tn-say { position: absolute; left: 50%; bottom: 96%; translate: -50% 0; background: #fff; color: #3b2a2a; border-radius: 3cqmin; padding: .5cqmin 2cqmin; font: 700 clamp(11px, 3.4cqmin, 18px)/1.4 'Be Vietnam Pro', system-ui, sans-serif; white-space: nowrap; box-shadow: 0 .6cqmin 2cqmin rgba(0, 0, 0, .18); animation: tn-in .3s cubic-bezier(.3, 1.6, .5, 1); z-index: 2; }
.tn-say::after { content: ''; position: absolute; left: 50%; top: 100%; translate: -50% -1px; border: 1.2cqmin solid transparent; border-top-color: #fff; }
@keyframes tn-in { from { scale: .3; opacity: 0; } }
.tn-zzz { position: absolute; left: 30%; bottom: 82%; font: 800 4cqmin/1 system-ui, sans-serif; color: #dbe4ff; }
.tn-zzz i { position: absolute; font-style: normal; opacity: 0; animation: tn-z 2.7s ease-out infinite; }
.tn-zzz i:nth-child(2) { animation-delay: .9s; font-size: .8em; }
.tn-zzz i:nth-child(3) { animation-delay: 1.8s; font-size: 1.2em; }
@keyframes tn-z { 15% { opacity: 1; } to { transform: translate(-4cqmin, -9cqmin); opacity: 0; } }

/* ---------- đạo cụ ---------- */
.tn-p { position: absolute; width: calc(var(--w) * 1cqmin); translate: -50% -50%; z-index: 2; }
.tn-p > svg { display: block; width: 100%; height: auto; overflow: visible; }
.tn-p.tn-bottom { translate: -50% -100%; transform-origin: 50% 100%; }
.tn-f > .tn-p { z-index: 1; }
.tn-float { animation: tn-float 2.6s ease-in-out infinite; }
@keyframes tn-float { 50% { transform: translateY(-1.6cqmin) rotate(-3deg); } }
.tn-flap { transform-box: fill-box; transform-origin: 50% 0; transition: transform .5s ease-in-out; }
.tn-p.open .tn-flap { transform: scaleY(-1); }
.tn-glint { filter: drop-shadow(0 0 1.4cqmin #a5d8ff) drop-shadow(0 0 3cqmin #d0bfff); animation: tn-glint 1.4s ease-in-out infinite; }
@keyframes tn-glint { 50% { filter: drop-shadow(0 0 .5cqmin #a5d8ff); } }
.tn-twinkle { filter: drop-shadow(0 0 2cqmin #ffe066); animation: tn-twinkle 1.8s ease-in-out infinite; }
@keyframes tn-twinkle { 50% { transform: scale(1.12) rotate(8deg); filter: drop-shadow(0 0 4cqmin #ffe066); } }
.tn-ladder { height: 40cqh; }
.tn-ladder > svg { height: 100%; }
.tn-p.lit { filter: drop-shadow(0 0 2cqmin #ffe066); }
.tn-p.lit::after { content: '⭐'; position: absolute; left: 50%; top: 58%; translate: -50% -50%; font-size: calc(var(--w) * .45cqmin); animation: tn-twinkle 1.8s ease-in-out infinite; }
.tn-glow { position: absolute; width: 70cqmin; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 236, 153, .55), rgba(255, 224, 102, .18) 40%, transparent 68%); z-index: 1; pointer-events: none; }
.tn-door { transform-box: fill-box; transform-origin: 0 50%; transition: transform .6s; }
.tn-p.open .tn-door { transform: scaleX(.15); }
.tn-bloom { position: absolute; width: 7%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; scale: 0; transition: scale .45s cubic-bezier(.3, 1.8, .5, 1);
  background: radial-gradient(circle, #ffd43b 0 22%, transparent 24%), conic-gradient(from 0deg, #ffa8c5 0 20%, #ff8fab 0 40%, #ffa8c5 0 60%, #ff8fab 0 80%, #ffa8c5 0);
  -webkit-mask: radial-gradient(circle, #000 64%, transparent 66%); mask: radial-gradient(circle, #000 64%, transparent 66%); }
.tn-bloom.on { scale: 1; }
.tn-candles { position: absolute; left: 50%; top: 22%; translate: -50% -100%; display: flex; gap: 4%; width: 52%; justify-content: center; }
.tn-candles i { position: relative; width: 6%; min-width: 3px; height: calc(var(--w) * .2cqmin); border-radius: 2px; background: repeating-linear-gradient(-45deg, #fff 0 4px, #ff8787 4px 8px); }
.tn-candles b { position: absolute; left: 50%; bottom: 100%; width: 260%; aspect-ratio: .65; translate: -50% 0; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fff 0 20%, #ffd43b 40%, #ff922b 75%); box-shadow: 0 0 1.6cqmin #ffd43b; animation: tn-flame .3s ease-in-out infinite alternate; transform-origin: 50% 100%; transition: opacity .3s, scale .3s; }
@keyframes tn-flame { to { transform: scaleY(1.15) rotate(4deg); } }
.tn-candles.out b { opacity: 0; scale: .2; }
.tn-p.trail { filter: drop-shadow(0 .6cqmin .8cqmin rgba(0, 0, 0, .18)); }

/* hiệu ứng nổ, chữ bay, hạt rơi */
.tn-pop { position: absolute; z-index: 7; font-size: 4.6cqmin; line-height: 1; translate: -50% -50%; pointer-events: none; animation: tn-burst 1.3s ease-out forwards; }
.tn-pop.still { animation: none; }
.tn-pop.big { font-size: 7cqmin; }
@keyframes tn-burst { from { transform: scale(.4); opacity: 1; } 70% { opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1.15); opacity: 0; } }
.toon-word { position: absolute; z-index: 7; translate: -50% -50%; padding: .35em .9em; border-radius: 99px; background: rgba(255, 255, 255, .92); color: var(--accent); font: 700 clamp(12px, 3.8cqmin, 20px)/1.3 var(--bf); white-space: nowrap; box-shadow: 0 .6cqmin 2cqmin rgba(0, 0, 0, .15); pointer-events: none; animation: tn-rise 4.2s ease-out forwards; }
@keyframes tn-rise { from { transform: translateY(0) scale(.4); opacity: 0; } 15% { transform: translateY(-2cqh) scale(1); opacity: 1; } 75% { opacity: 1; } to { transform: translateY(-18cqh) scale(1); opacity: 0; } }
.tn-fall { position: absolute; inset: 0; overflow: hidden; }
.tn-fall i { position: absolute; top: -8%; left: var(--x); font-style: normal; font-size: var(--fs); line-height: 1; color: #fff; animation: tn-fall var(--d) linear var(--dl) infinite; }
@keyframes tn-fall { to { transform: translate(var(--dx), 118cqh) rotate(320deg); } }
.tn-fall.rain i { width: 2px; height: 4.5cqh; background: linear-gradient(transparent, rgba(255, 255, 255, .85)); rotate: 12deg; animation-name: tn-rain; }
@keyframes tn-rain { to { transform: translate(-6cqh, 118cqh); } }
.tn-fall.snow i { color: #fff; text-shadow: 0 0 .6cqmin #a5d8ff; }
.tn-fall.sparkle i { color: #ffe066; text-shadow: 0 0 1cqmin #ffd43b; }
.tn-fall.confetti i { width: 1.4cqmin; height: 2.4cqmin; border-radius: 2px; }
.tn-fall.soft { opacity: .55; }

/* ---------- thoại, nút ---------- */
.tn-cap { position: absolute; left: 50%; top: 8cqh; translate: -50% 0; z-index: 6; width: max-content; max-width: min(88cqw, 560px); padding: .65em 1.2em; border-radius: 1.4em;
  background: rgba(255, 255, 255, .88); color: #3b2f35; text-align: center; font: 600 clamp(13px, 4cqmin, 22px)/1.45 var(--bf); box-shadow: 0 1cqmin 4cqmin rgba(0, 0, 0, .12);
  opacity: 0; pointer-events: none; transition: opacity .35s; }
.tn-cap.in { opacity: 1; animation: tn-capin .5s ease-out; }
@keyframes tn-capin { from { transform: translateY(-1.5cqh); opacity: 0; } }
/* lời dẫn kiểu phụ đề: dải đất ngay dưới chân nhân vật (mặt đất ở 66%) — trời để trống cho hành động */
.tn-cap.lo { top: 70cqh; }
.tn-cap.lo.in { animation-name: tn-capup; }
@keyframes tn-capup { from { transform: translateY(1.5cqh); opacity: 0; } }
/* nút chạm sát đáy khung, dưới lời dẫn — không che ao/sông/cá ở dải đất */
.tn-tap { position: absolute; left: 50%; bottom: 5cqh; translate: -50% 0; z-index: 8; border: 0; border-radius: 99px; padding: .75em 1.4em; cursor: pointer;
  background: var(--accent); color: #fff; font: 800 clamp(13px, 3.9cqmin, 19px) 'Be Vietnam Pro', system-ui, sans-serif; box-shadow: 0 1cqmin 4cqmin rgba(0, 0, 0, .25);
  animation: tn-pulse 1.3s ease-in-out infinite; transition: opacity .3s; white-space: nowrap; }
.tn-tap.out { opacity: 0; pointer-events: none; }
@keyframes tn-pulse { 50% { transform: scale(1.07); box-shadow: 0 0 0 1.6cqmin color-mix(in srgb, var(--accent) 30%, transparent); } }
.tn-skip, .tn-replay { position: absolute; top: 2.4cqmin; right: 2.4cqmin; z-index: 9; border: 0; border-radius: 99px; padding: .45em 1em; cursor: pointer;
  background: rgba(0, 0, 0, .3); color: #fff; font: 700 clamp(11px, 3cqmin, 14px) 'Be Vietnam Pro', system-ui, sans-serif; backdrop-filter: blur(4px); }
.tn-replay { background: rgba(255, 255, 255, .85); color: #3b2f35; }
#stage .tn-skip, #stage .tn-replay { top: 14px; right: 14px; }

/* câu hỏi Có / Không (cupid) */
.tn-ask { position: absolute; left: 50%; top: 34%; translate: -50% -50%; z-index: 6; width: min(80cqw, 62cqh); padding: 4cqmin 4cqmin 5cqmin; border-radius: 4cqmin; background: #fff;
  box-shadow: 0 2cqmin 7cqmin rgba(0, 0, 0, .22); text-align: center; color: #3b2f35; }
.tn-ask small { display: block; font: 600 clamp(11px, 3.2cqmin, 16px) var(--bf); opacity: .7; }
.tn-ask-ph { width: 20cqmin; aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: .8cqmin solid color-mix(in srgb, var(--accent) 35%, #fff); margin: 0 auto 2cqmin; display: block; }
.tn-ask-q { font: 400 clamp(20px, 7.4cqmin, 40px)/1.2 var(--tf); color: var(--accent); margin: 1.5cqmin 0 4cqmin; overflow-wrap: anywhere; }
.tn-ask-b { display: flex; justify-content: center; gap: 4cqmin; min-height: 11cqmin; }
.tn-ask-b button { border: 0; border-radius: 99px; padding: .6em 1.5em; cursor: pointer; font: 800 clamp(13px, 4.2cqmin, 20px) 'Be Vietnam Pro', system-ui, sans-serif; transition: scale .3s cubic-bezier(.3, 1.6, .5, 1), left .3s, top .3s; }
.tn-yes { position: relative; background: var(--accent); color: #fff; box-shadow: 0 1cqmin 3cqmin color-mix(in srgb, var(--accent) 45%, transparent); z-index: 2; }
.tn-no { background: #f1f3f5; color: #495057; }
.tn-no.run { position: absolute; translate: -50% -50%; }
/* lá thư mở ra lúc kết (ốc sên, máy bay giấy) */
.tn-letter { position: absolute; left: 50%; top: 33%; translate: -50% -50%; z-index: 6; width: min(46cqw, 34cqh); padding: 3cqmin 3cqmin 3.5cqmin; border-radius: 2cqmin; background: #fffdf7;
  box-shadow: 0 1.5cqmin 5cqmin rgba(0, 0, 0, .2); text-align: center; display: grid; gap: 1.5cqmin; justify-items: center; color: var(--accent); }
.tn-letter small { font: 400 clamp(16px, 5.6cqmin, 30px)/1.2 var(--tf); }
.tn-letter b { font-size: 10cqmin; line-height: 1; }
.tn-letter img { width: 70%; aspect-ratio: 1; object-fit: cover; border-radius: 1.5cqmin; }
.tn-letter span { font: 600 clamp(11px, 3cqmin, 15px) var(--bf); color: #868e96; }
.tn-letter span:empty { display: none; }

/* ---------- khung kết: tên người nhận + lời chúc (ẩn trong lúc diễn) ---------- */
.sc-text.toon, .sc-text.toon ~ .sc-bottom { opacity: 0; transition: opacity .9s .2s, translate .9s .2s; }
.sc-text.toon ~ .sc-bottom { translate: 0 3cqh; }
.cs.tn-done .sc-text.toon, .cs.tn-done .sc-text.toon ~ .sc-bottom { opacity: 1; translate: 0 0; }
.sc-text.toon .sc-name { top: 12.5%; font-size: clamp(18px, 8cqmin, 56px); color: var(--accent); text-shadow: 0 0 .4cqmin #fff, 0 0 1.4cqmin #fff, 0 0 3cqmin rgba(255, 255, 255, .9); }
.cs.scene:not(.light) .sc-text.toon .sc-name { color: #fff; text-shadow: 0 0 1.5cqmin var(--accent), 0 0 4cqmin var(--accent); }
.sc-text.toon ~ .sc-bottom { bottom: 3.5cqh; max-height: 27cqh; width: min(90cqw, 560px); padding: 2.2cqmin 4cqmin; border-radius: 3cqmin; background: rgba(255, 255, 255, .92);
  color: #3b2f35; text-shadow: none; box-shadow: 0 1cqmin 4cqmin rgba(0, 0, 0, .15); z-index: 4; }
.sc-text.toon ~ .sc-bottom .sc-title, .sc-text.toon ~ .sc-bottom .sc-from b { color: var(--accent); text-shadow: none; }
.sc-text.toon ~ .sc-bottom:has(.sc-msg:empty):not(:has(.sc-title)):not(:has(.sc-from)) { display: none; }
/* màn ngang (máy tính): 27% chiều cao chỉ đủ 2–3 dòng → khung lời chúc cao hơn, hẹp lại cho dễ đọc */
@container (min-aspect-ratio: 4/3) { .sc-text.toon ~ .sc-bottom { max-height: 38cqh; width: min(64cqw, 620px); bottom: 3cqh; } }

/* ảnh thu nhỏ / bản tĩnh: dừng mọi chuyển động */
.cs.static.tn-stage *, .cs.static.tn-stage *::before, .cs.static.tn-stage *::after { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) { .tn-fall.rain i { animation-duration: 2s; } .tn-tap { animation: none; } }
.tn-beat { animation: tn-beat 1.1s ease-in-out infinite; filter: drop-shadow(0 1.5cqmin 3cqmin rgba(230, 73, 128, .35)); }
@keyframes tn-beat { 0%, 100% { scale: 1; } 15% { scale: 1.1; } 30% { scale: .98; } 45% { scale: 1.06; } }
.tn-heart-ph { position: absolute; left: 50%; top: 45%; width: 52%; aspect-ratio: 1; translate: -50% -50%; object-fit: cover; border-radius: 50%; border: .8cqmin solid #fff; }
.tn-float2 { animation: tn-float2 2.4s ease-in-out infinite; }
@keyframes tn-float2 { 50% { translate: -50% -62%; } }
.tn-clear { position: absolute; inset: 0; background: linear-gradient(180deg, #74c0fc 0%, #d0ebff 50%, #fff9db 100%); }

/* =================== Đợt 2 (toon-more.js) =================== */
.tn-noname .sc-text.toon .sc-name { display: none; }
/* chung: lơ lửng, đung đưa, bay, với tay */
.tn-hover > .tn-f { animation: tn-hover 2.4s ease-in-out infinite; }
@keyframes tn-hover { 50% { translate: 0 -2.2cqmin; } }
.tn-a.float > .tn-f { animation: tn-hover 2s ease-in-out infinite; }
.tn-swing { transform-origin: 50% 0; animation: tn-swingk 2.6s ease-in-out infinite; }
@keyframes tn-swingk { 0%, 100% { rotate: -5deg; } 50% { rotate: 5deg; } }
.tn-a.flying .tn-cape { animation: tn-flutter .22s ease-in-out infinite alternate; }
.tn-cape { transform-box: view-box; transform-origin: 50px 62px; }
@keyframes tn-flutter { from { transform: skewX(-8deg) scaleY(.95); } to { transform: skewX(8deg) scaleY(1.05); } }
.tn-a.reach .tn-arm { animation: tn-flail .18s ease-in-out infinite alternate; }
@keyframes tn-flail { from { transform: rotate(-40deg); } to { transform: rotate(-110deg); } }
.tn-wing2 { transform-box: fill-box; transform-origin: 90% 90%; animation: tn-wag 1.2s ease-in-out infinite alternate; }
.tn-wing2.r { transform-origin: 10% 90%; }
.tn-prop { transform-box: fill-box; transform-origin: center; animation: tn-spin .12s linear infinite; }
@keyframes tn-spin { 50% { transform: scaleY(.15); } }
.tn-smoke-tail { transform-box: fill-box; transform-origin: 50% 0; animation: tn-wag 1.4s ease-in-out infinite alternate; }
.tn-lights circle { animation: tn-twk 1s steps(2) infinite; }
.tn-lights circle:nth-child(2n) { animation-delay: -.5s; }
.tn-boom { position: absolute; z-index: 8; translate: -50% -50%; font: 900 clamp(14px, 6cqmin, 34px)/1 'Be Vietnam Pro', system-ui, sans-serif; color: #fff; -webkit-text-stroke: .5cqmin #e8590c; paint-order: stroke; pointer-events: none; animation: tn-boom .9s ease-out forwards; }
.tn-boom.red { -webkit-text-stroke-color: #c92a2a; color: #ffe066; }
@keyframes tn-boom { from { transform: scale(.3) rotate(-12deg); opacity: 0; } 25% { transform: scale(1.2) rotate(6deg); opacity: 1; } to { transform: scale(1) translateY(-6cqh); opacity: 0; } }

/* siêu nhân: thanh máu boss, tia yêu thương, quái vật hoá mây trắng */
.tn-hp { position: absolute; left: 50%; bottom: 100%; translate: -50% -.5cqmin; width: 90%; text-align: center; font: 800 clamp(10px, 3cqmin, 15px)/1.3 'Be Vietnam Pro', system-ui, sans-serif; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.tn-hp i { display: block; height: 1.6cqmin; margin-top: .5cqmin; border-radius: 99px; background: rgba(0, 0, 0, .35); overflow: hidden; border: 2px solid #fff; }
.tn-hp em { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #fa5252, #ffa94d); transition: width .3s; }
.tn-beam { position: absolute; z-index: 6; height: 1.4cqmin; translate: 0 -50%; transform-origin: 0 50%; border-radius: 99px; pointer-events: none;
  background: linear-gradient(90deg, #fff, var(--bc, #ff6b9d)); box-shadow: 0 0 2cqmin var(--bc, #ff6b9d), 0 0 5cqmin var(--bc, #ff6b9d); animation: tn-beamk .4s ease-out forwards; }
@keyframes tn-beamk { from { scale: 0 1; } 30% { scale: 1 1; opacity: 1; } to { opacity: 0; scale: 1 .3; } }
.tn-gbody, .tn-brow, .tn-frown, .tn-grin, .tn-gdrops { transition: fill .6s, opacity .4s; }
.tn-grin { opacity: 0; }
.tn-a.tamed .tn-gbody { fill: #fff; }
.tn-a.tamed .tn-brow, .tn-a.tamed .tn-frown, .tn-a.tamed .tn-gdrops { opacity: 0; }
.tn-a.tamed .tn-grin { opacity: 1; }

/* đĩa bay: tia hút, hộp quà, quà hiện ra */
.tn-ray { position: absolute; z-index: 2; width: 26cqmin; height: 40cqh; translate: -50% 0; opacity: 0; pointer-events: none; transition: opacity .3s;
  background: linear-gradient(180deg, rgba(255, 249, 196, .85), rgba(255, 249, 196, .1)); clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%); }
.tn-ray.on { opacity: 1; }
.tn-lid { transform-box: fill-box; transform-origin: 0 100%; transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); }
.tn-lid.off { transform: translate(-10px, -40px) rotate(-35deg); }
.tn-pick { cursor: pointer; animation: tn-pickk 1s ease-in-out infinite; filter: drop-shadow(0 0 1.6cqmin #fff9c4); }
@keyframes tn-pickk { 50% { transform: translateY(-1.6cqmin) scale(1.06); } }
.tn-gift-reveal { position: absolute; z-index: 7; translate: -50% -50%; display: grid; justify-items: center; gap: 1.5cqmin; pointer-events: none; }
.tn-gift-reveal span { font-size: 18cqmin; line-height: 1; filter: drop-shadow(0 1cqmin 2cqmin rgba(0, 0, 0, .2)); animation: tn-beat 1.2s ease-in-out infinite; }
.tn-gift-reveal b { max-width: 60cqmin; padding: .4em .9em; border-radius: 99px; background: #fff; color: var(--accent); font: 800 clamp(12px, 3.8cqmin, 19px)/1.3 var(--bf); text-align: center; box-shadow: 0 .8cqmin 3cqmin rgba(0, 0, 0, .15); }

/* ninja: lướt nhanh, giả làm bụi cây khi bị nhìn */
.tn-a.dash > .tn-f { filter: blur(.4px); }
.tn-a.dash::before { content: ''; position: absolute; right: 70%; top: 40%; width: 60%; height: 30%; background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .5) 0 2px, transparent 2px 7px); }
.tn-a.bushy > .tn-f { opacity: 0; }
.tn-a.bushy::after { content: '🌳'; position: absolute; left: 50%; bottom: 0; translate: -50% 0; font-size: calc(var(--s) * .9cqmin); line-height: 1; }

/* thần đèn: thảm, điều ước */
.tn-rug { position: absolute; left: 18%; right: 18%; top: calc(66% - 1.2cqh); height: 4cqh; border-radius: 50%; z-index: 1;
  background: repeating-linear-gradient(90deg, #c92a2a 0 3cqmin, #e8590c 3cqmin 6cqmin); box-shadow: 0 0 0 .6cqmin #ffd43b inset; }
.tn-wish { position: absolute; z-index: 6; translate: -50% -50%; display: flex; align-items: center; gap: .5em; width: max-content; max-width: 44cqmin; padding: .45em .9em .45em .45em; border-radius: 99px;
  background: linear-gradient(135deg, #fff9db, #fff); color: #5f3dc4; font: 700 clamp(11px, 3.4cqmin, 17px)/1.3 var(--bf); box-shadow: 0 0 2.5cqmin rgba(255, 212, 59, .7), 0 .6cqmin 2cqmin rgba(0, 0, 0, .15); }
.tn-wish i { flex: none; display: grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: #7048e8; color: #fff; font-style: normal; font-weight: 800; }

/* máy gắp thú */
.tn-machine { position: absolute; left: 50%; top: 21%; width: 76%; height: 44%; translate: -50% 0; z-index: 2; border-radius: 3cqmin 3cqmin 1.5cqmin 1.5cqmin;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000)); box-shadow: 0 2cqmin 5cqmin rgba(0, 0, 0, .25); }
.tn-msign { position: absolute; left: 0; right: 0; top: 0; height: 13%; display: grid; place-items: center; color: #fff; font: 900 clamp(11px, 4cqmin, 20px) 'Be Vietnam Pro', system-ui, sans-serif; letter-spacing: .08em; text-shadow: 0 0 1.5cqmin #ffe066; }
.tn-glass { position: absolute; left: 5%; right: 5%; top: 14%; bottom: 14%; border-radius: 1.5cqmin; overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, .55), rgba(208, 235, 255, .35) 40%, rgba(255, 255, 255, .25)), #e7f5ff; box-shadow: inset 0 0 0 .5cqmin rgba(255, 255, 255, .7); }
.tn-glass::after { content: ''; position: absolute; right: 2%; bottom: 0; width: 18%; height: 34%; border-radius: 1cqmin 1cqmin 0 0; background: rgba(0, 0, 0, .25); }
.tn-mbase { position: absolute; left: 5%; right: 5%; bottom: 3%; height: 9%; border-radius: 1cqmin; background: rgba(0, 0, 0, .25); }
.tn-mbase i { position: absolute; right: 6%; top: 15%; width: 16%; height: 70%; border-radius: 1cqmin; background: #212529; }
.tn-a.toy { z-index: 1; }
.tn-claw { position: absolute; top: 0; width: 13cqmin; translate: -50% 0; z-index: 3; }
.tn-cable { position: absolute; left: 50%; top: 0; bottom: 8cqmin; width: 2px; translate: -50% 0; background: #495057; }
.tn-claw > svg { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; }
.tn-cl { transform-box: fill-box; transition: transform .35s; }
.tn-cl.l { transform-origin: 100% 0; }
.tn-cl.r { transform-origin: 0 0; }
.tn-claw.open .tn-cl.l { transform: rotate(28deg); }
.tn-claw.open .tn-cl.r { transform: rotate(-28deg); }
.tn-claw > .tn-a { z-index: 2; }
.tn-captop { transform-box: fill-box; transform-origin: 0 100%; transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); }
.tn-p.open .tn-captop { transform: translate(-6px, -18px) rotate(-60deg); }

/* viết tên lên trời bằng khói */
.tn-smoke { position: absolute; top: 22%; translate: 0 -50%; z-index: 4; overflow: hidden; white-space: nowrap; pointer-events: none; }
.tn-smoke span { display: inline-block; padding: 0 .1em; font: 400 clamp(26px, 13cqmin, 84px)/1.3 var(--tf); color: #fff;
  text-shadow: 0 0 .3cqmin rgba(28, 126, 214, .55), 0 0 .8cqmin #fff, 0 0 2.5cqmin rgba(255, 255, 255, .9), .6cqmin .6cqmin 2cqmin rgba(0, 0, 0, .15); -webkit-text-stroke: .15cqmin rgba(28, 126, 214, .35); }

/* trăng, đèn lồng, đèn ông sao */
.tn-moonglow { filter: drop-shadow(0 0 5cqmin rgba(255, 236, 153, .75)); }
.tn-p.lit { filter: drop-shadow(0 0 2cqmin #ffd43b) drop-shadow(0 0 5cqmin rgba(255, 212, 59, .6)); }
.tn-lampbody { transition: filter .4s; }
.tn-p.lit .tn-lampbody { filter: brightness(1.3); }
.tn-ltag { position: absolute; left: 50%; top: 104%; translate: -50% 0; white-space: nowrap; padding: .2em .7em; border-radius: 99px; background: rgba(255, 255, 255, .92); color: #3b2f35;
  font: 700 clamp(9px, 2.8cqmin, 14px) var(--bf); animation: tn-in .4s cubic-bezier(.3, 1.6, .5, 1); }
.tn-string { position: absolute; left: 4%; right: 4%; top: 22%; height: 6cqh; border-bottom: 2px solid rgba(255, 255, 255, .45); border-radius: 0 0 50% 50% / 0 0 100% 100%; z-index: 3; }
.tn-darkness { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 60%, rgba(10, 8, 30, .75), rgba(5, 4, 15, .95)); opacity: .86; z-index: 1; }
.tn-glint2 { filter: drop-shadow(0 0 1.2cqmin #ffe066); }
.tn-glint3 { animation: tn-glint3 1s ease-in-out infinite; }
@keyframes tn-glint3 { 50% { filter: drop-shadow(0 0 3cqmin #fff3bf) drop-shadow(0 0 6cqmin #ffd43b) brightness(1.3); } }
.tn-candles.unlit b { opacity: 0; scale: .2; }
.tn-pinestar { transform-box: fill-box; transform-origin: center; animation: tn-twinkle 1.6s ease-in-out infinite; }

/* hồ câu cá */
.tn-pond { position: absolute; left: 40%; right: -12%; top: 69%; height: 20%; border-radius: 50%; z-index: 1; background: radial-gradient(ellipse at 50% 40%, #74c0fc, #1c7ed6); box-shadow: inset 0 1cqh 0 rgba(255, 255, 255, .25); }
.tn-dock { position: absolute; left: 6%; width: 34%; top: calc(66% - .6cqh); height: 3cqh; z-index: 1; background: repeating-linear-gradient(90deg, #a47148 0 4cqmin, #8d6346 4cqmin 4.4cqmin); border-radius: .6cqmin; }
.tn-line { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; }
.tn-bob { animation: tn-bobk 1.6s ease-in-out infinite; }
@keyframes tn-bobk { 50% { transform: translateY(-.6cqmin); } }
.tn-bob.dip { animation: none; transform: translateY(1.8cqmin); transition: transform .12s; }

/* múa lân: băng rôn chúc */
.tn-banner { position: absolute; left: 50%; top: 31%; translate: -50% -50%; z-index: 6; padding: .35em 1.2em; border-radius: .4em; white-space: nowrap;
  background: linear-gradient(180deg, #e03131, #c92a2a); color: #ffe066; font: 400 clamp(20px, 8cqmin, 48px)/1.2 var(--tf); border: .6cqmin solid #ffd43b; box-shadow: 0 1cqmin 4cqmin rgba(0, 0, 0, .25); }

/* người tuyết: từng phần rơi xuống ghép lại, sống dậy */
.tn-sp { transform-box: view-box; transition: opacity .35s, transform .45s cubic-bezier(.3, 1.4, .5, 1); }
.tn-a.build .tn-sp { opacity: 0; transform: translateY(-14px); }
.tn-a.build .tn-sp.on { opacity: 1; transform: none; }
.tn-a.build:not(.alive) .tn-eyes, .tn-a.build:not(.alive) .tn-mouth { opacity: 0; }
.tn-a.build .tn-eyes, .tn-a.build .tn-mouth { transition: opacity .4s; }
.tn-a.build.wave .tn-arm.r { animation: tn-snowwave .4s ease-in-out infinite alternate; transform-origin: 0 100%; }
@keyframes tn-snowwave { from { transform: rotate(0); } to { transform: rotate(-25deg); } }
.tn-win { position: absolute; z-index: 6; width: 64cqmin; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 236, 153, .55) 0 10deg, transparent 10deg 20deg); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%); animation: tn-rays 8s linear infinite; }
@keyframes tn-rays { to { rotate: 360deg; } }
.cs.static .tn-ltag, .cs.static .tn-wish, .cs.static .tn-gift-reveal span { animation: none !important; }
/* khuất khỏi màn hình: dừng mọi chuyển động (đỡ tốn pin, cuộn trang mượt) */
.tn-off *, .tn-off *::before, .tn-off *::after { animation-play-state: paused !important; }
/* chủ thiệp / bản xem trước có thanh công cụ trên cùng: đẩy tên và lời dẫn xuống để không bị che */
body:has(#owner-bar:not(.hidden)) .sc-text.toon .sc-name { top: calc(12.5% + 34px); }
body:has(#owner-bar:not(.hidden)) #stage .tn-cap:not(.lo) { top: calc(8cqh + 40px); }

/* bí ngô (Halloween — kịch bản trick): mặt tối, thắp lên thì mắt miệng sáng vàng, không gắn ngôi sao như đèn lồng */
.tn-jackp .tn-jface { transition: fill .5s; }
.tn-jackp.lit .tn-jface { fill: #ffd43b; }
.tn-jackp.lit { filter: drop-shadow(0 0 1.6cqmin #ffb347) drop-shadow(0 0 5cqmin rgba(255, 146, 43, .55)); }
.tn-jackp.lit::after { content: none; }
