/* =====================================================================
   overlays.css — toast / modal & bottom sheet / pull-to-refresh /
   customer-service FAB / carousel / marquee / lightbox / func buttons
   ===================================================================== */

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--sab) + 18px); transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(22, 22, 38, .92); backdrop-filter: blur(16px); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600; animation: toast-in .45s var(--spring) both; pointer-events: auto; }
.toast.leaving { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(24px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px) scale(.95); } }
.toast .t-ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 900; flex: none; color: #fff; background: var(--info); }
.toast.ok .t-ic { background: var(--ok); }
.toast.err .t-ic { background: var(--danger); }
.toast.warn .t-ic { background: var(--warn); color: #1a1200; }
.toast .bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--grad-brand); transform-origin: left; animation: toast-bar linear forwards; }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- Modal / bottom sheet ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(5, 5, 12, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-end; justify-content: center; animation: ov-in .25s ease both; }
.overlay.center { align-items: center; padding: 24px; }
.overlay.closing { animation: ov-out .2s ease forwards; }
.overlay.closing .sheet { animation: sheet-out .22s ease-in forwards; }
@keyframes ov-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ov-out { to { opacity: 0; } }
.sheet { width: 100%; max-width: 480px; max-height: 88vh; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain; padding: 14px 18px calc(18px + var(--sab)); border-radius: var(--r-xl) var(--r-xl) 0 0; background: rgba(20, 20, 36, .96); animation: sheet-in .5s var(--spring) both; }
.overlay.center .sheet { border-radius: var(--r-xl); padding: 22px 20px 18px; max-width: 360px; animation: pop-sheet .45s var(--spring) both; }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-out { to { transform: translateY(40px); opacity: 0; } }
@keyframes pop-sheet { from { opacity: 0; transform: scale(.85) translateY(20px); } to { opacity: 1; transform: none; } }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .22); margin: 0 auto 14px; }
.modal-ic { width: 60px; height: 60px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(255, 61, 127, .25), rgba(139, 92, 246, .3)); color: var(--primary); animation: pop-in .5s var(--spring) both; }
.modal-ic svg { width: 30px; height: 30px; }
.modal-ic.gold { color: var(--gold); background: linear-gradient(135deg, rgba(247, 201, 72, .22), rgba(217, 167, 46, .15)); }
.modal-ic.danger { color: #FCA5A5; background: rgba(239, 68, 68, .16); }
.modal-title { font-size: 18px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.modal-sub { font-size: 13.5px; color: var(--muted); text-align: center; line-height: 1.55; white-space: pre-line; margin-bottom: 18px; }
.modal-foot { display: flex; gap: 10px; margin-top: 8px; }
.modal-foot .btn { flex: 1; }
.sheet-title { font-size: 17px; font-weight: 800; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }

/* ---------- Pull to refresh ---------- */
.ptr { position: fixed; top: calc(var(--topbar-h) + var(--sat)); left: 50%; transform: translate(-50%, -60px); z-index: 25; display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgba(22, 22, 38, .9); border: 1px solid var(--line-2); font-size: 12px; color: var(--muted); transition: transform .25s var(--ease-out), opacity .2s; opacity: 0; }
.ptr.show { transform: translate(-50%, 12px); opacity: 1; }
.ptr-ring { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--primary); transform: rotate(var(--rot, 0deg)); }
.ptr.loading .ptr-ring { animation: spin .8s linear infinite; }

/* ---------- Customer service FAB (draggable) ---------- */
.cs-fab { position: fixed; z-index: 40; right: 14px; bottom: calc(var(--tabbar-h) + var(--sab) + 18px); width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-brand); box-shadow: 0 10px 28px rgba(255, 61, 127, .45); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.cs-fab.left { right: auto; left: 14px; }
.cs-fab.dragging { cursor: grabbing; transition: none; }
.cs-fab .cs-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255, 61, 127, .8); animation: glow-ring 2s ease-out infinite; }
.cs-fab .cs-ring::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid rgba(139, 92, 246, .8); animation: glow-ring 2s ease-out .6s infinite; }
.cs-ic { width: 23px; height: 23px; color: #fff; position: relative; z-index: 1; }
.cs-ic svg, .cs-ic img { width: 100%; height: 100%; object-fit: contain; }
.cs-lbl { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 9.5px; font-weight: 700; color: var(--text); background: rgba(20, 20, 36, .9); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); white-space: nowrap; pointer-events: none; }

/* ---------- Carousel (5 effects) ---------- */
.carousel { position: relative; aspect-ratio: 21 / 10; border-radius: var(--r-lg); overflow: hidden; background: var(--bg-2); box-shadow: var(--shadow); perspective: 1100px; user-select: none; -webkit-user-select: none; touch-action: pan-y; margin-bottom: 14px; isolation: isolate; }
.carousel .slides { position: absolute; inset: 0; transform-style: preserve-3d; }
.carousel .slide { position: absolute; inset: 0; display: block; overflow: hidden; will-change: transform, opacity; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.carousel .slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel .slide-ph { width: 100%; height: 100%; display: grid; place-items: center; font-weight: 800; font-size: 22px; background: var(--grad-brand); }
.carousel .slide-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 14px 12px; background: linear-gradient(0deg, rgba(5, 5, 12, .85), transparent); }
.carousel .slide-cap b { display: block; font-size: 15px; font-weight: 800; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.carousel .slide-cap span { display: block; font-size: 11.5px; color: rgba(255, 255, 255, .75); margin-top: 2px; }
.carousel .cap-anim b, .carousel .cap-anim span { animation: fade-up .6s var(--ease-out) both; }
.carousel .cap-anim span { animation-delay: .12s; }
.carousel .dots { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 5px; z-index: 5; }
.carousel .dot { width: 6px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .4); transition: width .3s, background .3s; }
.carousel .dot.on { width: 18px; background: #fff; box-shadow: 0 0 8px rgba(255, 255, 255, .8); }
.carousel .progress { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; z-index: 6; background: rgba(255, 255, 255, .15); }
.carousel .progress i { display: block; height: 100%; width: 0; background: var(--grad-brand); box-shadow: 0 0 10px rgba(255, 61, 127, .8); }
.carousel .progress i.run { transition: width var(--interval, 4500ms) linear; width: 100%; }
/* effect transforms driven by --off (relative slide offset) */
.carousel[data-fx="slide"] .slide { transform: translate3d(calc(var(--off, 0) * 100%), 0, 0); transition: transform var(--dur, .65s) var(--ease-out); }
.carousel.dragging[data-fx="slide"] .slide { transition: none; }
.carousel[data-fx="fade"] .slide { opacity: 0; transition: opacity var(--dur, .65s) ease; }
.carousel[data-fx="fade"] .slide.cur { opacity: 1; }
.carousel[data-fx="zoom"] .slide { opacity: 0; transform: scale(1.18); transition: opacity var(--dur, .7s) ease, transform var(--dur, .7s) var(--ease-out); }
.carousel[data-fx="zoom"] .slide.cur { opacity: 1; transform: scale(1); }
.carousel[data-fx="zoom"] .slide.cur img { animation: ken-burns 7s ease-out both; }
@keyframes ken-burns { from { transform: scale(1); } to { transform: scale(1.1); } }
.carousel[data-fx="cube"] .slide { transform-origin: center center calc(var(--w, 400px) / -2); transform: rotateY(calc(var(--off, 0) * 90deg)); transition: transform var(--dur, .8s) var(--ease-out); }
.carousel[data-fx="cube"] .slide:not(.cur):not(.prev):not(.next) { visibility: hidden; }
.carousel[data-fx="parallax"] .slide { transform: translate3d(calc(var(--off, 0) * 100%), 0, 0); transition: transform var(--dur, .75s) var(--ease-out); }
.carousel[data-fx="parallax"] .slide img { transform: translate3d(calc(var(--off, 0) * -35%), 0, 0) scale(1.35); transition: transform var(--dur, .75s) var(--ease-out); }
.carousel[data-fx="parallax"] .slide-cap { transform: translate3d(calc(var(--off, 0) * 40%), 0, 0); transition: transform var(--dur, .75s) var(--ease-out); }

/* ---------- Marquee ---------- */
.marquee { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: 10px; background: linear-gradient(90deg, rgba(255, 61, 127, .14), rgba(139, 92, 246, .14)); border: 1px solid var(--line); margin-bottom: 16px; overflow: hidden; }
.marquee .mq-ic { width: 18px; height: 18px; color: var(--gold); flex: none; animation: float-y 2.2s ease-in-out infinite; }
.marquee .mq-track { flex: 1; overflow: hidden; -webkit-mask: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.marquee .mq-in { display: inline-flex; gap: 48px; white-space: nowrap; animation: marquee var(--mq-dur, 18s) linear infinite; will-change: transform; }
.marquee:hover .mq-in, .marquee.paused .mq-in { animation-play-state: paused; }
.marquee .mq-in span { font-size: 12.5px; font-weight: 600; color: #FDE68A; }
.marquee .mq-in a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(0, 0, 0, .94); display: flex; flex-direction: column; animation: ov-in .2s ease both; touch-action: pan-y; }
.lightbox.closing { animation: ov-out .2s ease forwards; }
.lb-top { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--sat) + 12px) 16px 12px; color: var(--muted); font-size: 13px; font-family: var(--font-num); }
.lb-track { flex: 1; display: flex; transition: transform .35s var(--ease-out); will-change: transform; }
.lightbox.dragging .lb-track { transition: none; }
.lb-item { flex: none; width: 100vw; display: grid; place-items: center; padding: 0 8px; }
.lb-item img { max-height: 78vh; max-width: 100%; object-fit: contain; border-radius: 8px; box-shadow: var(--shadow-lg); animation: pop-in .35s var(--ease-out) both; }
.lb-dots { display: flex; justify-content: center; gap: 6px; padding: 14px 0 calc(var(--sab) + 20px); }
.lb-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .3); }
.lb-dots i.on { background: var(--primary); box-shadow: 0 0 8px var(--primary); }

/* ---------- Function buttons (4 grid) ---------- */
.func-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.func-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px 8px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--line); position: relative; overflow: hidden; transition: transform .2s var(--spring); }
.func-btn:active { transform: scale(.94); }
.func-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--fb-bg, var(--grad-brand)); animation: breathe 2.6s ease-in-out infinite; animation-delay: calc(var(--i, 0) * .35s); }
.func-ic svg { width: 21px; height: 21px; }
.func-ic img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.func-btn span { font-size: 11px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
