/* =====================================================================
   LaiMusic — Hiệu ứng & chuyển động (FX) + thông báo "Đang phát"
   Mọi giá trị điều khiển bởi js/fx.js qua data-fx-* và biến CSS trên <html>:
     --fx-k (hệ số thời lượng) · --fx-ease (đường cong) · --fx-stagger (trễ lần lượt)
   ===================================================================== */
:root { --fx-k: 1; --fx-ease: cubic-bezier(.3,0,.2,1); --fx-stagger: 25ms; }
:root[data-fx="on"] {
  --ease: var(--fx-ease);
  --t-fast: calc(.15s * var(--fx-k));
  --t-card: calc(.18s * var(--fx-k));
}
/* Tắt hết */
:root[data-fx="off"] *, :root[data-fx="off"] *::before, :root[data-fx="off"] *::after {
  animation: none !important; transition: none !important;
}

/* ---------- Keyframes dùng chung ---------- */
@keyframes fx-fade  { from { opacity: 0; } }
@keyframes fx-up    { from { opacity: 0; transform: translateY(16px); } }
@keyframes fx-up-sm { from { opacity: 0; transform: translateY(8px); } }
@keyframes fx-left  { from { opacity: 0; transform: translateX(24px); } }
@keyframes fx-zoom  { from { opacity: 0; transform: scale(.96); } }
@keyframes fx-pop   { 0% { opacity: 0; transform: scale(.85); } 60% { opacity: 1; transform: scale(1.03); } 100% { transform: none; } }
@keyframes fx-blur  { from { opacity: 0; filter: blur(10px); } }
@keyframes fx-flip  { from { opacity: 0; transform: perspective(900px) rotateX(10deg) translateY(10px); transform-origin: top center; } }
@keyframes fx-flipdown { from { opacity: 0; transform: perspective(600px) rotateX(-60deg); transform-origin: top center; } }
@keyframes fx-spin-in { from { opacity: 0; transform: rotate(-90deg) scale(.6); } }
@keyframes fx-ripple { to { transform: scale(1); opacity: 0; } }
@keyframes fx-pulse { 0% { box-shadow: 0 0 0 0 rgba(34,199,169,.55); } 70%, 100% { box-shadow: 0 0 0 10px rgba(34,199,169,0); } }
@keyframes fx-mq { 0%, 12% { transform: none; } 88%, 100% { transform: translateX(var(--fx-mq, 0)); } }
@keyframes fx-eqbars {
  0%, 100% { background-size: 3px 30%, 3px 70%, 3px 45%, 100% 100%; }
  33%      { background-size: 3px 80%, 3px 35%, 3px 65%, 100% 100%; }
  66%      { background-size: 3px 50%, 3px 90%, 3px 30%, 100% 100%; }
}

/* ---------- Chuyển trang ---------- */
:root[data-fx] .view { animation: none; }
:root[data-fx-page="fade"]      .view.fx-page { animation: fx-fade  calc(.25s * var(--fx-k)) var(--fx-ease) both; }
:root[data-fx-page="slideUp"]   .view.fx-page { animation: fx-up    calc(.32s * var(--fx-k)) var(--fx-ease) both; }
:root[data-fx-page="slideLeft"] .view.fx-page { animation: fx-left  calc(.32s * var(--fx-k)) var(--fx-ease) both; }
:root[data-fx-page="zoom"]      .view.fx-page { animation: fx-zoom  calc(.3s  * var(--fx-k)) var(--fx-ease) both; }
:root[data-fx-page="blur"]      .view.fx-page { animation: fx-blur  calc(.4s  * var(--fx-k)) var(--fx-ease) both; }
:root[data-fx-page="flip"]      .view.fx-page { animation: fx-flip  calc(.4s  * var(--fx-k)) var(--fx-ease) both; }

/* ---------- Hàng / thẻ xuất hiện lần lượt ---------- */
.fx-row:not(.fx-row-done) { animation-delay: calc(var(--fx-i, 0) * var(--fx-stagger)) !important; animation-fill-mode: both !important; }
:root[data-fx-rows="slide"]     .fx-row:not(.fx-row-done) { animation: fx-up       calc(.34s * var(--fx-k)) var(--fx-ease); }
:root[data-fx-rows="slideLeft"] .fx-row:not(.fx-row-done) { animation: fx-left     calc(.34s * var(--fx-k)) var(--fx-ease); }
:root[data-fx-rows="fade"]      .fx-row:not(.fx-row-done) { animation: fx-fade     calc(.3s  * var(--fx-k)) var(--fx-ease); }
:root[data-fx-rows="pop"]       .fx-row:not(.fx-row-done) { animation: fx-pop      calc(.42s * var(--fx-k)) var(--fx-ease); }
:root[data-fx-rows="blur"]      .fx-row:not(.fx-row-done) { animation: fx-blur     calc(.4s  * var(--fx-k)) var(--fx-ease); }
:root[data-fx-rows="flip"]      .fx-row:not(.fx-row-done) { animation: fx-flipdown calc(.45s * var(--fx-k)) var(--fx-ease); }

/* ---------- Rê chuột vào thẻ ---------- */
.mcard, .plcard, .pl-card { transition: background var(--t-card) var(--ease), transform calc(.25s * var(--fx-k)) var(--ease), box-shadow calc(.25s * var(--fx-k)) var(--ease); }
.mcard-cover img { transition: transform calc(.4s * var(--fx-k)) var(--ease); }
:root[data-fx-card="lift"] :is(.mcard, .plcard, .pl-card):hover { transform: translateY(-4px); }
:root[data-fx-card="zoom"] :is(.mcard, .plcard, .pl-card):hover .mcard-cover img { transform: scale(1.07); }
:root[data-fx-card="glow"] :is(.mcard, .plcard, .pl-card):hover { box-shadow: 0 0 0 1px rgba(34,199,169,.35), 0 10px 32px rgba(34,199,169,.18); }
:root[data-fx-card="tilt"] :is(.mcard, .plcard, .pl-card):hover { transform: perspective(700px) rotateX(4deg) rotateY(-5deg) translateY(-3px); }

/* ---------- Nút bấm ---------- */
:root[data-fx-btn="bounce"] :is(.btn, .icon-btn) { transition: transform calc(.4s * var(--fx-k)) cubic-bezier(.34,1.9,.64,1), background var(--t-fast), color var(--t-fast), border-color var(--t-fast), opacity var(--t-fast); }
:root[data-fx-btn="bounce"] :is(.btn, .icon-btn):active:not(:disabled) { transform: scale(.86); transition-duration: .06s; }
:root[data-fx-btn="squish"] :is(.btn, .icon-btn) { transition: transform calc(.3s * var(--fx-k)) cubic-bezier(.34,1.56,.64,1), background var(--t-fast), color var(--t-fast), border-color var(--t-fast), opacity var(--t-fast); }
:root[data-fx-btn="squish"] :is(.btn, .icon-btn):active:not(:disabled) { transform: scale(1.1, .82); transition-duration: .06s; }
:root[data-fx-btn="none"] :is(.btn, .icon-btn, .pb-play, .mcard-play):is(:hover, :active) { transform: none !important; }

/* Gợn sóng */
.fx-ripple-wrap { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; z-index: 0; }
.fx-ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .22; transform: scale(0); pointer-events: none;
  animation: fx-ripple calc(.6s * var(--fx-k)) ease-out forwards; }

/* ---------- Cửa sổ (modal) — desktop/tablet; điện thoại vẫn là bottom sheet ---------- */
.modal-back { animation-duration: calc(.2s * var(--fx-k)); }
@media (min-width: 768px) {
  :root[data-fx-modal="zoom"]  .modal { animation: fx-pop   calc(.32s * var(--fx-k)) var(--fx-ease) both; }
  :root[data-fx-modal="fade"]  .modal { animation: fx-fade  calc(.25s * var(--fx-k)) var(--fx-ease) both; }
  :root[data-fx-modal="slide"] .modal { animation: fx-up    calc(.32s * var(--fx-k)) var(--fx-ease) both; }
  :root[data-fx-modal="flip"]  .modal { animation: fx-flipdown calc(.45s * var(--fx-k)) var(--fx-ease) both; }
  :root[data-fx-modal="drop"]  .modal { animation: fx-drop  calc(.6s  * var(--fx-k)) cubic-bezier(.2,.8,.2,1) both; }
  :root[data-fx-modal="none"]  .modal, :root[data-fx-modal="none"] .modal-back { animation: none; }
}
@keyframes fx-drop { 0% { opacity: 0; transform: translateY(-80px); } 60% { opacity: 1; transform: translateY(8px); } 80% { transform: translateY(-3px); } 100% { transform: none; } }
@media (max-width: 767px) {
  .modal { animation-duration: calc(.26s * var(--fx-k)) !important; }
  :root[data-fx-modal="none"] .modal { animation: none !important; }
}

/* ---------- Menu thả xuống ---------- */
@keyframes fx-drop-scale { from { opacity: 0; transform: scale(.9); } }
@keyframes fx-drop-slide { from { opacity: 0; transform: translateY(-8px); } }
.user-drop { transform-origin: top right; }
:root[data-fx-drop="slide"] .user-drop { animation: fx-drop-slide calc(.18s * var(--fx-k)) var(--fx-ease); }
:root[data-fx-drop="scale"] .user-drop { animation: fx-drop-scale calc(.2s  * var(--fx-k)) var(--fx-ease); }
:root[data-fx-drop="fade"]  .user-drop { animation: fx-fade       calc(.16s * var(--fx-k)) var(--fx-ease); }
:root[data-fx-drop="none"]  .user-drop { animation: none; }
@media (min-width: 1024px) {
  .more-menu { transform-origin: top right; }
  :root[data-fx-drop="slide"] .more.open .more-menu { animation: fx-drop-slide calc(.16s * var(--fx-k)) var(--fx-ease); }
  :root[data-fx-drop="scale"] .more.open .more-menu { animation: fx-drop-scale calc(.18s * var(--fx-k)) var(--fx-ease); }
  :root[data-fx-drop="fade"]  .more.open .more-menu { animation: fx-fade       calc(.15s * var(--fx-k)) var(--fx-ease); }
  :root[data-fx-drop="none"]  .more.open .more-menu { animation: none; }
}
@media (max-width: 1023px) {
  .more.open .more-menu { animation-duration: calc(.26s * var(--fx-k)) !important; }
}

/* ---------- Thông báo chung (UI.toast) ---------- */
.toast { transition: opacity calc(.2s * var(--fx-k)) var(--fx-ease), transform calc(.28s * var(--fx-k)) var(--fx-ease); }
:root[data-fx-toastgen="zoom"] .toast      { transform: translateX(-50%) scale(.8); }
:root[data-fx-toastgen="zoom"] .toast.show { transform: translateX(-50%) scale(1); }
:root[data-fx-toastgen="fade"] .toast, :root[data-fx-toastgen="fade"] .toast.show { transform: translateX(-50%); }
:root[data-fx-toastgen="none"] .toast { transition: none; }

/* ---------- Màn hình Đang phát ---------- */
:root[data-fx] .np:not(.hidden) { animation-duration: calc(.3s * var(--fx-k)); }
:root[data-fx-np="zoom"] .np:not(.hidden) { animation-name: fx-zoom; }
:root[data-fx-np="fade"] .np:not(.hidden) { animation-name: fx-fade; }
:root[data-fx-np="none"] .np:not(.hidden) { animation: none; }
:root[data-fx] .np-title, :root[data-fx] .np-artist { animation-duration: calc(.25s * var(--fx-k)); }
:root[data-fx] .np-cover img.np-cover-img { animation-duration: calc(.35s * var(--fx-k)); animation-timing-function: var(--fx-ease); }
:root[data-fx-cover="fade"] .np-cover img.np-cover-img { animation-name: fx-fade; }
:root[data-fx-cover="spin"] .np-cover img.np-cover-img { animation-name: fx-spin-in; animation-duration: calc(.5s * var(--fx-k)); }
:root[data-fx-cover="blur"] .np-cover img.np-cover-img { animation-name: fx-blur; animation-duration: calc(.5s * var(--fx-k)); }
:root[data-fx-cover="none"] .np-cover img.np-cover-img { animation: none; }

/* ---------- Thanh phát nhạc ---------- */
:root[data-fx-pbtitle="slide"] :is(.pb-title, .pb-artist).fx-swap { animation: fx-up-sm calc(.3s * var(--fx-k)) var(--fx-ease) both; }
:root[data-fx-pbtitle="slide"] .pb-artist.fx-swap { animation-delay: calc(.05s * var(--fx-k)); }
:root[data-fx-pbtitle="slide"] .pb-cover.fx-swap  { animation: fx-pop calc(.4s * var(--fx-k)) var(--fx-ease) both; }
:root[data-fx-pbtitle="fade"]  :is(.pb-title, .pb-artist, .pb-cover).fx-swap { animation: fx-fade calc(.3s * var(--fx-k)) var(--fx-ease) both; }
.pb-title.fx-mq-on { text-overflow: clip; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.pb-title .fx-mq { display: inline-block; animation: fx-mq var(--fx-mq-d, 6s) ease-in-out 1.5s infinite alternate; }
.pb-cover { transition: border-radius calc(.3s * var(--fx-k)) var(--ease); }
:root[data-fx-vinyl="1"] .pb-cover { border-radius: 50%; }
:root[data-fx-vinyl="1"] body.fx-playing .pb-cover:not(.fx-swap) { animation: spin calc(8s * var(--fx-k)) linear infinite; }
:root[data-fx-pulse="1"] body.fx-playing .pb-play { animation: fx-pulse calc(2s * var(--fx-k)) ease-out infinite; }

/* Cột sóng nhạc trên bài đang phát */
.song-thumb { position: relative; }
:root[data-fx-eq="1"] body.fx-playing .song.playing .song-thumb::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    linear-gradient(var(--accent), var(--accent)) left 32% bottom 28% / 3px 30% no-repeat,
    linear-gradient(var(--accent), var(--accent)) left 50% bottom 28% / 3px 70% no-repeat,
    linear-gradient(var(--accent), var(--accent)) left 68% bottom 28% / 3px 45% no-repeat,
    rgba(0,0,0,.55);
  animation: fx-eqbars calc(.9s * var(--fx-k)) ease-in-out infinite;
  transition: opacity var(--t-fast);
}
:root[data-fx-eq="1"] body.fx-playing .song.playing:hover .song-thumb::after { opacity: 0; }

/* Phát sáng */
:root[data-fx-glow="1"] body.fx-playing .song.playing { box-shadow: inset 3px 0 0 var(--accent); }
:root[data-fx-glow="1"] body.fx-playing .pb-seek { filter: drop-shadow(0 0 4px rgba(34,199,169,.45)); }

/* Đang tải / menu bên */
:root[data-fx-shimmer="0"] .sk, :root[data-fx-shimmer="0"] .uq-processing .upl-progress-fill { animation: none; }
.nav a .ni { transition: transform calc(.2s * var(--fx-k)) var(--fx-ease); }
:root[data-fx-navnudge="1"] .nav a:hover .ni { transform: translateX(3px) scale(1.08); }
:root[data-fx-navnudge="1"] .nav a.active .ni { animation: fx-pop calc(.4s * var(--fx-k)) var(--fx-ease); }

/* =====================================================================
   Thông báo "Đang phát" (js/np-toast.js)
   ===================================================================== */
.npt-host {
  position: fixed; inset: 0; z-index: 90; pointer-events: none; visibility: hidden;
  display: flex; padding: 16px;
  padding-top: calc(72px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--pbar-h) + var(--nav-h) + var(--safe-b) + 16px);
}
.npt-host.on { visibility: visible; }
.npt-host[data-pos^="t"] { align-items: flex-start; }
.npt-host[data-pos^="m"] { align-items: center; }
.npt-host[data-pos^="b"] { align-items: flex-end; }
.npt-host[data-pos$="l"] { justify-content: flex-start; }
.npt-host[data-pos$="c"] { justify-content: center; }
.npt-host[data-pos$="r"] { justify-content: flex-end; }
@media (min-width: 1024px) { .npt-host[data-pos$="l"] { padding-left: calc(var(--sidebar-w) + 24px); } }

.npt {
  --npt-c: 52px; --npt-r: 14px;
  pointer-events: auto; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px;
  width: 340px; max-width: calc(100vw - 32px); padding: 10px 14px 12px 10px;
  border-radius: var(--npt-r); color: var(--text);
  background: var(--panel-2); box-shadow: var(--shadow);
  translate: var(--npt-ox, 0) var(--npt-oy, 0);
  opacity: 0;
}
.npt-host.on .npt { opacity: 1; }
.npt.npt-clickable { cursor: pointer; }
.npt[data-size="sm"] { --npt-c: 40px; width: 280px; gap: 10px; padding: 8px 12px 10px 8px; }
.npt[data-size="lg"] { --npt-c: 68px; width: 400px; gap: 14px; padding: 12px 16px 14px 12px; }
.npt[data-size="lg"] .npt-title { font-size: 16.5px; }

.npt[data-style="glass"] {
  background: color-mix(in srgb, var(--panel-2) 70%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--line-soft);
}
.npt[data-style="solid"]   { background: var(--panel-2); border: 1px solid var(--line-soft); }
.npt[data-style="outline"] { background: var(--bg); border: 1.5px solid var(--accent); }
.npt[data-style="accent"]  { background: var(--accent); color: var(--accent-ink); }
.npt[data-style="gradient"] { background: linear-gradient(135deg, var(--accent) 0%, #4f7cff 60%, #a35cff 100%); color: #fff; }
.npt[data-style="accent"] .npt-label, .npt[data-style="accent"] .npt-sub { color: rgba(4,20,15,.72); }
.npt[data-style="gradient"] .npt-label, .npt[data-style="gradient"] .npt-sub { color: rgba(255,255,255,.85); }
.npt[data-style="accent"] .npt-eq i, .npt[data-style="accent"] .npt-bar i { background: var(--accent-ink); }
.npt[data-style="gradient"] .npt-eq i, .npt[data-style="gradient"] .npt-bar i { background: #fff; }
.npt.npt-glow { box-shadow: var(--shadow), 0 0 0 1px rgba(34,199,169,.22), 0 12px 40px rgba(34,199,169,.28); }

.npt-cover {
  width: var(--npt-c); height: var(--npt-c); flex: none; overflow: hidden;
  border-radius: calc(var(--npt-r) * .6); background: var(--panel); position: relative; z-index: 1;
}
.npt-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.npt-cover .art-fallback { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.npt-cover.spin { border-radius: 50%; animation: spin calc(6s * var(--fx-k)) linear infinite; }
.npt-cover.spin::after { content: ""; position: absolute; left: 50%; top: 50%; width: 22%; height: 22%; transform: translate(-50%,-50%); border-radius: 50%; background: var(--panel-2); box-shadow: 0 0 0 2px rgba(0,0,0,.25); }

.npt-body { min-width: 0; flex: 1; position: relative; z-index: 1; padding-right: 18px; }
.npt-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 2px;
}
.npt-title { font-size: 14.5px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.npt-sub { font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

.npt-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.npt-eq i { width: 2.5px; height: 100%; background: var(--accent); border-radius: 1px; transform-origin: bottom; animation: npt-eq calc(.8s * var(--fx-k)) ease-in-out infinite; }
.npt-eq i:nth-child(2) { animation-delay: -.3s; } .npt-eq i:nth-child(3) { animation-delay: -.55s; } .npt-eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes npt-eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

.npt-x {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 24px; height: 24px; border-radius: 50%; border: none; padding: 0; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: inherit; opacity: .55;
  transition: opacity var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.npt-x:hover { opacity: 1; background: rgba(127,127,127,.2); transform: rotate(90deg); }

.npt-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(127,127,127,.15); z-index: 1; }
.npt-bar i { display: block; height: 100%; background: var(--accent); transform-origin: left; animation: npt-life var(--npt-life, 4s) linear forwards; }
.npt.npt-paused .npt-bar i { animation-play-state: paused; }
@keyframes npt-life { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.npt-shine {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%);
  transform: translateX(-110%); animation: npt-shine calc(1.1s * var(--fx-k)) calc(.25s * var(--fx-k)) ease forwards;
}
@keyframes npt-shine { to { transform: translateX(110%); } }

/* Hiệu ứng vào */
.npt.is-in  { animation-duration: calc(.45s * var(--fx-k)); animation-timing-function: var(--fx-ease); animation-fill-mode: both; }
.npt.is-out { animation-duration: calc(.32s * var(--fx-k)); animation-timing-function: cubic-bezier(.5,0,.75,0); animation-fill-mode: both; animation-direction: reverse; }
.npt:is(.is-in[data-enter="bounce"], .is-in[data-enter="elastic"], .is-in[data-enter="drop"], .is-in[data-enter="swing"], .is-in[data-enter="roll"]) {
  animation-duration: calc(.75s * var(--fx-k)); animation-timing-function: ease-out;
}
.npt.is-out:is([data-exit="bounce"], [data-exit="elastic"], [data-exit="drop"], [data-exit="swing"], [data-exit="roll"]) { animation-duration: calc(.5s * var(--fx-k)); }

.npt:is(.is-in[data-enter="slide"],   .is-out[data-exit="slide"])   { animation-name: npt-slide; }
.npt:is(.is-in[data-enter="fade"],    .is-out[data-exit="fade"])    { animation-name: fx-fade; }
.npt:is(.is-in[data-enter="zoom"],    .is-out[data-exit="zoom"])    { animation-name: npt-zoom; }
.npt:is(.is-in[data-enter="bounce"],  .is-out[data-exit="bounce"])  { animation-name: npt-bounce; }
.npt:is(.is-in[data-enter="elastic"], .is-out[data-exit="elastic"]) { animation-name: npt-elastic; }
.npt:is(.is-in[data-enter="flip"],    .is-out[data-exit="flip"])    { animation-name: npt-flip; }
.npt:is(.is-in[data-enter="blur"],    .is-out[data-exit="blur"])    { animation-name: npt-blur; }
.npt:is(.is-in[data-enter="drop"],    .is-out[data-exit="drop"])    { animation-name: npt-drop; }
.npt:is(.is-in[data-enter="swing"],   .is-out[data-exit="swing"])   { animation-name: npt-swing; transform-origin: top center; }
.npt:is(.is-in[data-enter="roll"],    .is-out[data-exit="roll"])    { animation-name: npt-roll; }
.npt.is-in[data-enter="none"] { animation: none; }

@keyframes npt-slide { from { opacity: 0; transform: translate(var(--npt-dx), var(--npt-dy)); } }
@keyframes npt-zoom  { from { opacity: 0; transform: scale(.7); } }
@keyframes npt-bounce {
  0%   { opacity: 0; transform: translate(var(--npt-dx), var(--npt-dy)); }
  55%  { opacity: 1; transform: translate(calc(var(--npt-dx) * -.18), calc(var(--npt-dy) * -.18)); }
  75%  { transform: translate(calc(var(--npt-dx) * .08), calc(var(--npt-dy) * .08)); }
  90%  { transform: translate(calc(var(--npt-dx) * -.03), calc(var(--npt-dy) * -.03)); }
  100% { opacity: 1; transform: none; }
}
@keyframes npt-elastic {
  0% { opacity: 0; transform: scale(.3); } 45% { opacity: 1; transform: scale(1.12); }
  65% { transform: scale(.94); } 82% { transform: scale(1.03); } 100% { opacity: 1; transform: none; }
}
@keyframes npt-flip {
  0% { opacity: 0; transform: perspective(700px) rotateX(-85deg); transform-origin: top center; }
  60% { opacity: 1; transform: perspective(700px) rotateX(14deg); transform-origin: top center; }
  100% { opacity: 1; transform: perspective(700px) rotateX(0); transform-origin: top center; }
}
@keyframes npt-blur  { from { opacity: 0; filter: blur(14px); transform: scale(1.08); } }
@keyframes npt-drop  {
  0% { opacity: 0; transform: translateY(-140px); } 60% { opacity: 1; transform: translateY(10px); }
  80% { transform: translateY(-4px); } 100% { opacity: 1; transform: none; }
}
@keyframes npt-swing {
  0% { opacity: 0; transform: rotate(-28deg); } 40% { opacity: 1; transform: rotate(12deg); }
  60% { transform: rotate(-6deg); } 80% { transform: rotate(3deg); } 100% { opacity: 1; transform: none; }
}
@keyframes npt-roll  { from { opacity: 0; transform: translate(calc(var(--npt-dx) * 2.5), calc(var(--npt-dy) * 2.5)) rotate(-120deg) scale(.6); } }

/* Đổi bài khi thông báo đang hiện */
.npt.npt-swap :is(.npt-body, .npt-cover) { animation: npt-swap calc(.38s * var(--fx-k)) var(--fx-ease) both; }
.npt.npt-swap .npt-cover { animation-name: npt-swap-c; }
.npt.npt-swap .npt-cover.spin { animation: npt-swap-c calc(.38s * var(--fx-k)) var(--fx-ease) both, spin calc(6s * var(--fx-k)) linear infinite; }
@keyframes npt-swap   { from { opacity: 0; transform: translateY(10px); } }
@keyframes npt-swap-c { from { opacity: 0; transform: scale(.6) rotate(-20deg); } }

@media (max-width: 767px) {
  .npt-host { padding-left: 12px; padding-right: 12px; padding-top: calc(64px + env(safe-area-inset-top, 0px)); }
  .npt { width: 100%; max-width: 420px; }
}

/* =====================================================================
   Cửa sổ "Hiệu ứng & chuyển động"
   ===================================================================== */
.modal.fx-modal { max-width: 720px; }
.fx-modal .modal-actions { justify-content: flex-start; gap: 8px; }
.fx-modal .modal-actions .btn:last-child { margin-left: auto; }
.fx-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin: 0 0 4px; scrollbar-width: none; }
.fx-tabs::-webkit-scrollbar { display: none; }
.fx-tab {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 8px 14px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--bg-2); color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  transition: background var(--t-fast), color var(--t-fast);
}
.fx-tab:hover { color: var(--text); }
.fx-tab.on { background: var(--text); color: var(--bg); }
.fx-panel { max-height: min(56vh, 520px); overflow-y: auto; margin: 0 -8px; padding: 0 8px; animation: fx-up-sm calc(.25s * var(--fx-k)) var(--fx-ease) both; }
.fx-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.fx-item:last-child { border-bottom: none; }
.fx-item.fx-col { flex-direction: column; align-items: stretch; gap: 8px; }
.fx-row-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fx-lbl { font-size: 14px; font-weight: 600; color: var(--text); }
.fx-lbl small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.fx-val { font-size: 12.5px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fx-select { width: auto; min-width: 180px; }
.fx-text { width: 220px; }
.fx-json { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; resize: vertical; }
.fx-range { width: 100%; accent-color: var(--accent); }
.fx-modal.fx-disabled .fx-panel-general .fx-item:not(:first-child) { opacity: .5; }

.fx-switch { position: relative; width: 44px; height: 24px; flex: none; cursor: pointer; }
.fx-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.fx-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--hover); transition: background var(--t-fast); pointer-events: none; }
.fx-switch span::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform calc(.22s * var(--fx-k)) var(--fx-ease);
}
.fx-switch input:checked + span { background: var(--accent); }
.fx-switch input:checked + span::after { transform: translateX(20px); }
.fx-switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.fx-seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--bg-2); padding: 4px; border-radius: 12px; }
.fx-seg button {
  position: relative; flex: 1 1 auto; min-height: 32px; padding: 6px 12px; border: none; border-radius: 9px; cursor: pointer;
  background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.fx-seg button:hover { color: var(--text); }
.fx-seg button.on { background: var(--text); color: var(--bg); }

.fx-pos { display: grid; grid-template-columns: repeat(3, 72px); grid-template-rows: repeat(3, 48px); gap: 6px; padding: 8px; background: var(--bg-2); border-radius: 12px; width: max-content; }
.fx-pos button { position: relative; border: 1.5px dashed var(--line); background: transparent; border-radius: 8px; cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.fx-pos button i { position: absolute; width: 26px; height: 9px; border-radius: 3px; background: var(--muted-2); transition: background var(--t-fast), transform var(--t-fast); }
.fx-pos button[data-v^="t"] i { top: 6px; } .fx-pos button[data-v^="m"] i { top: calc(50% - 4.5px); } .fx-pos button[data-v^="b"] i { bottom: 6px; }
.fx-pos button[data-v$="l"] i { left: 6px; } .fx-pos button[data-v$="c"] i { left: calc(50% - 13px); } .fx-pos button[data-v$="r"] i { right: 6px; }
.fx-pos button:hover { border-color: var(--muted); }
.fx-pos button.on { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.fx-pos button.on i { background: var(--accent); transform: scale(1.1); }
.fx-pos-mid { display: grid; place-items: center; color: var(--muted-2); }
.fx-presets { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 767px) {
  .fx-item:not(.fx-col) { flex-wrap: wrap; }
  .fx-select, .fx-text { width: 100%; min-width: 0; }
}

/* Quyền thông báo Chrome trong tab "Thông báo Đang phát" */
.fx-notif > small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.fx-perm-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.fx-perm-row small { flex-basis: 100%; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.fx-perm { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--bg-2); }
.fx-perm.ok { color: var(--accent); }
.fx-perm.warn { color: #f5c451; }
.fx-perm.err { color: #ff7a7a; }
