/* Trình chiếu slide dữ liệu điểm: tab "Trình chiếu" trong Xây dựng dữ liệu + trình phát toàn màn hình. */

/* ----- Nút mở trình chiếu ----- */
.pd-act-slides .pd-act-ico { background: #7c3aed; color: #fff; box-shadow: 0 3px 8px rgba(124, 58, 237, .35); }
.pd-act-slides:hover { background: #f3edff; border-color: #d4c2fb; }
.pd-act[hidden] { display: none; }
.pd-act-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pd-slides-btn { flex: none; background: #7c3aed !important; border-color: #7c3aed !important; box-shadow: 0 2px 0 #5b21b6 !important; }
.pd-slides-btn:hover { background: #6d28d9 !important; }
.pd-slides-btn[hidden] { display: none !important; }
@media (max-width: 720px) { .pd-slides-btn span { display: none; } }

/* ----- Tab Trình chiếu (xây dựng) ----- */
.ss-ed { display: flex; flex-direction: column; gap: 16px; }
.ss-ed svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ss-ed-intro { display: flex; gap: 10px; align-items: flex-start; background: #f3edff; border: 1px solid #e0d4fb; color: #4c2a85; padding: 12px 14px; border-radius: 12px; }
.ss-ed-intro svg { color: #7c3aed; margin-top: 1px; }
.ss-ed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ss-box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ss-box-title { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; color: var(--pd-ink); }
.ss-box-title svg { color: #7c3aed; }
.ss-total { font-style: normal; font-weight: 700; font-size: 12.5px; color: var(--muted); background: var(--panel2); padding: 2px 8px; border-radius: 99px; }
.ss-total:empty { display: none; }
.ss-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ss-unit { display: flex; align-items: center; gap: 8px; }
.ss-unit em { font-style: normal; color: var(--muted); font-weight: 700; font-size: 13px; }
.ss-unit.sm .pd-input { width: 76px; padding: 7px 9px; }

.ss-trs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ss-tr { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px; border: 1.5px solid var(--line); border-radius: 11px; cursor: pointer; font-size: 12.5px; font-weight: 700; text-align: center; color: var(--muted); background: #fff; }
.ss-tr:hover { border-color: #c9b5f7; }
.ss-tr input { position: absolute; opacity: 0; pointer-events: none; }
.ss-tr:has(input:checked) { border-color: #7c3aed; background: #f6f1ff; color: #4c1d95; box-shadow: 0 0 0 3px rgba(124, 58, 237, .14); }
.ss-tr:has(input:focus-visible) { outline: 2.5px solid #7c3aed; outline-offset: 2px; }
.ss-tr-demo { position: relative; width: 58px; height: 36px; border-radius: 6px; overflow: hidden; background: #e6ecf6; perspective: 200px; }
.ss-tr-demo i { position: absolute; inset: 0; border-radius: 6px; }
.ss-tr-demo i:first-child { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.ss-tr-demo i:last-child { background: linear-gradient(135deg, #fbbf24, #d97706); animation: ss-demo-in 2.4s infinite; }
.ss-tr-demo.t-fade i:last-child { animation-name: ss-demo-fade; }
.ss-tr-demo.t-slide i:last-child { animation-name: ss-demo-slide; }
.ss-tr-demo.t-zoom i:last-child { animation-name: ss-demo-zoom; }
.ss-tr-demo.t-flip i:last-child { animation-name: ss-demo-flip; }
.ss-tr-demo.t-blur i:last-child { animation-name: ss-demo-blur; }
.ss-tr-demo.t-rise i:last-child { animation-name: ss-demo-rise; }
.ss-tr-demo.t-none i:last-child { animation-name: ss-demo-none; animation-timing-function: steps(1); }
@keyframes ss-demo-fade { 0%, 25% { opacity: 0; } 50%, 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ss-demo-slide { 0%, 25% { transform: translateX(100%); } 50%, 85% { transform: none; } 100% { transform: translateX(-100%); } }
@keyframes ss-demo-zoom { 0%, 25% { opacity: 0; transform: scale(1.5); } 50%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: scale(.7); } }
@keyframes ss-demo-flip { 0%, 25% { transform: rotateY(90deg); } 50%, 85% { transform: none; } 100% { transform: rotateY(-90deg); } }
@keyframes ss-demo-blur { 0%, 25% { opacity: 0; filter: blur(6px); } 50%, 85% { opacity: 1; filter: none; } 100% { opacity: 0; filter: blur(6px); } }
@keyframes ss-demo-rise { 0%, 25% { opacity: 0; transform: translateY(60%); } 50%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-30%); } }
@keyframes ss-demo-none { 0% { opacity: 0; } 50% { opacity: 1; } }
.ss-tr-demo.t-slidev i:last-child { animation-name: ss-demo-slidev; }
.ss-tr-demo.t-wipe i:last-child { animation-name: ss-demo-wipe; }
.ss-tr-demo.t-circle i:last-child { animation-name: ss-demo-circle; }
.ss-tr-demo.t-diamond i:last-child { animation-name: ss-demo-diamond; }
.ss-tr-demo.t-cube i:last-child { animation-name: ss-demo-cube; transform-origin: 0% 50%; }
.ss-tr-demo.t-spin i:last-child { animation-name: ss-demo-spin; }
.ss-tr-demo.t-zoomout i:last-child { animation-name: ss-demo-zoomout; }
.ss-tr-demo.t-dip { background: #05070d; }
.ss-tr-demo.t-dip i:first-child { animation: ss-demo-dip-out 2.4s infinite; }
.ss-tr-demo.t-dip i:last-child { animation-name: ss-demo-dip-in; }
.ss-tr-demo.t-random i:last-child { animation: ss-demo-random 4.8s infinite; }
@keyframes ss-demo-slidev { 0%, 25% { transform: translateY(100%); } 50%, 85% { transform: none; } 100% { transform: translateY(-100%); } }
@keyframes ss-demo-wipe { 0%, 25% { clip-path: inset(0 0 0 100%); } 50%, 85% { clip-path: inset(0); } 100% { clip-path: inset(0 0 0 100%); } }
@keyframes ss-demo-circle { 0%, 25% { clip-path: circle(0% at 50% 50%); } 50%, 85% { clip-path: circle(75% at 50% 50%); } 100% { clip-path: circle(0% at 50% 50%); } }
@keyframes ss-demo-diamond { 0%, 25% { clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%); } 50%, 85% { clip-path: polygon(50% -50%, 150% 50%, 50% 150%, -50% 50%); } 100% { clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%); } }
@keyframes ss-demo-cube { 0%, 25% { transform: translateX(100%) rotateY(90deg); } 50%, 85% { transform: none; } 100% { transform: translateX(100%) rotateY(90deg); } }
@keyframes ss-demo-spin { 0%, 25% { opacity: 0; transform: rotate(-30deg) scale(.4); } 50%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: rotate(30deg) scale(1.4); } }
@keyframes ss-demo-zoomout { 0%, 25% { opacity: 0; transform: scale(.4); } 50%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes ss-demo-dip-out { 0%, 15% { opacity: 1; } 30%, 90% { opacity: 0; } 100% { opacity: 1; } }
@keyframes ss-demo-dip-in { 0%, 32% { opacity: 0; } 50%, 80% { opacity: 1; } 90%, 100% { opacity: 0; } }
@keyframes ss-demo-random {
  0%, 12% { opacity: 0; transform: translateX(100%); }
  25%, 37% { opacity: 1; transform: none; clip-path: circle(75% at 50% 50%); }
  50% { opacity: 1; clip-path: circle(0% at 50% 50%); }
  62% { opacity: 0; transform: scale(.4); clip-path: circle(75% at 50% 50%); }
  75%, 87% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: rotate(30deg) scale(1.4); }
}
@media (prefers-reduced-motion: reduce) { .ss-tr-demo i:last-child { animation: none; opacity: 0; } }

.ss-checks { display: flex; flex-direction: column; gap: 8px; }
.ss-check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.ss-check input { width: 18px; height: 18px; accent-color: #7c3aed; flex: none; }
.ss-check.muted span::after { content: " (chưa có mô tả)"; color: var(--muted); font-size: 12.5px; }

.ss-audio-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.ss-preview { width: 100%; height: 40px; }
.ss-preview[hidden], .ss-vol-field[hidden], .ss-up[hidden] { display: none; }
.ss-vol { width: 100%; accent-color: #7c3aed; }
.ss-vol-out { font-weight: 700; color: var(--muted); margin-left: 6px; font-size: 13px; }
.ss-note { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.ss-up { display: flex; flex-direction: column; gap: 4px; }
.ss-up-bar { height: 6px; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.ss-up-bar i { display: block; height: 100%; width: 0; background: #7c3aed; transition: width .2s; }
.ss-up-txt { color: var(--muted); font-size: 12.5px; }

.ss-order-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.ss-order-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.ss-grip-inline svg { width: 14px; height: 14px; vertical-align: -2px; }

.ss-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: none; }
.ss-list:empty::before { content: attr(data-empty); display: block; padding: 22px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line); border-radius: 12px; font-size: 13.5px; }
.ss-item { display: grid; grid-template-columns: auto auto 72px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .15s, box-shadow .15s, opacity .15s; }
.ss-item.ss-video { background: #fffaf3; }
.ss-item:hover { border-color: #c9b5f7; }
.ss-item.dragging { opacity: .45; border-style: dashed; border-color: #7c3aed; }
.ss-item.err { border-color: #f5a3b1; background: #fff6f7; }
.ss-grip { color: #9aa9c2; cursor: grab; display: grid; place-items: center; }
.ss-grip:active { cursor: grabbing; }
.ss-step { width: 26px; height: 26px; border-radius: 50%; background: #7c3aed; color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.ss-thumb { position: relative; width: 72px; height: 46px; border-radius: 8px; overflow: hidden; background: #e6ecf6; display: grid; place-items: center; color: #9aa9c2; }
.ss-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ss-thumb.broken img { display: none; }
.ss-thumb i { position: relative; display: grid; place-items: center; }
.ss-thumb img + i { display: none; }
.ss-thumb.video img + i, .ss-thumb.broken i { display: grid; width: 24px; height: 24px; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; }
.ss-thumb.video i svg { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.ss-info { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.ss-info b { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.ss-info small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-kind { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; padding: 1px 6px; border-radius: 5px; }
.ss-kind.image { background: #e8efff; color: #1d4ed8; }
.ss-kind.video { background: #ffedd5; color: #b45309; }
.ss-timing { display: flex; gap: 8px; align-items: center; }
.ss-t { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.ss-t > .pd-input { width: 92px; padding: 7px 9px; font-variant-numeric: tabular-nums; }
.ss-acts { display: flex; gap: 4px; }
.ss-acts .pd-icon-btn:disabled { opacity: .35; cursor: default; }
.ss-msg { grid-column: 1 / -1; margin: 0; display: flex; gap: 6px; align-items: center; color: #be123c; font-size: 12.5px; font-weight: 700; }
.ss-msg[hidden] { display: none; }
.ss-msg svg { width: 14px; height: 14px; }

@media (max-width: 860px) {
  .ss-ed-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .ss-item { grid-template-columns: auto 60px minmax(0, 1fr) auto; }
  .ss-grip { display: none; }
  .ss-thumb { width: 60px; height: 40px; }
  .ss-timing { grid-column: 1 / -1; grid-row: 2; flex-wrap: wrap; }
  .ss-acts { grid-column: 4; grid-row: 1; }
  .ss-row2 { grid-template-columns: 1fr; }
}

/* ----- Trình phát toàn màn hình ----- */
dialog.ss-player { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #05070d; color: #f4f6fb; font-family: "Nunito", ui-sans-serif, system-ui, sans-serif; overflow: hidden; }
dialog.ss-player::backdrop { background: #05070d; }
dialog.ss-player svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ss-root { --ss-ms: 900ms; position: absolute; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.ss-root.idle { cursor: none; }

.ss-top { padding: 10px 18px 8px; display: flex; flex-direction: column; gap: 8px; z-index: 3; transition: opacity .35s; }
.ss-segs { display: flex; gap: 4px; }
.ss-seg { flex: 1; height: 16px; padding: 6px 0; border: 0; background: none; cursor: pointer; }
.ss-seg::before { content: ""; display: block; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .22); }
.ss-seg i { display: block; height: 4px; margin-top: -4px; width: 0; border-radius: 99px; background: #fff; }
.ss-seg.video i { background: #fbbf24; }
.ss-seg.intro i { background: #a78bfa; }
.ss-seg:hover::before { background: rgba(255, 255, 255, .4); }
.ss-bar { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.ss-badge { font-size: 26px; line-height: 1; }
.ss-badge[hidden] { display: none; }
.ss-titles { display: flex; flex-direction: column; min-width: 0; }
.ss-title { font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-sub { font-size: 13px; color: rgba(244, 246, 251, .65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-sp { flex: 1; }
.ss-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; transition: background .15s, transform .1s; }
.ss-btn:hover { background: rgba(255, 255, 255, .22); }
.ss-btn:active:not(:disabled) { transform: scale(.94); }
.ss-btn:disabled { opacity: .35; cursor: default; }
.ss-btn[hidden] { display: none; }
.ss-btn.off { color: rgba(255, 255, 255, .55); }
.ss-btn.blocked { animation: ss-pulse 1.4s ease-in-out 3; }
.ss-close:hover { background: #dc2626; }
.ss-play { width: 54px; height: 54px; background: #fff; color: #05070d; }
.ss-play:hover { background: #e6ebf5; }
.ss-play svg { fill: currentColor; stroke: none; width: 24px; height: 24px; }
@keyframes ss-pulse { 50% { box-shadow: 0 0 0 8px rgba(167, 139, 250, .45); } }
:where(dialog.ss-player) :focus-visible { outline: 3px solid #a78bfa; outline-offset: 3px; }

.ss-ctrl { display: flex; align-items: center; gap: 12px; padding: 10px 18px 14px; z-index: 3; transition: opacity .35s; }
.ss-count { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; margin-left: 6px; }
.ss-time { font-variant-numeric: tabular-nums; color: rgba(244, 246, 251, .65); font-size: 14px; }
.ss-volw { display: flex; align-items: center; gap: 8px; color: rgba(244, 246, 251, .75); }
.ss-volw[hidden] { display: none; }
.ss-volw svg { width: 18px; height: 18px; }
.ss-volw input { width: 110px; accent-color: #a78bfa; }
.ss-unmute { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 99px; border: 0; background: #fbbf24; color: #1c1300; font: inherit; font-weight: 800; cursor: pointer; }
.ss-unmute[hidden] { display: none; }
.ss-unmute svg { width: 18px; height: 18px; }
.ss-root.idle .ss-top, .ss-root.idle .ss-ctrl { opacity: 0; }
.ss-root.idle .ss-top .ss-segs { opacity: 1; }
.ss-root.paused .ss-top, .ss-root.paused .ss-ctrl, .ss-root.ended .ss-top, .ss-root.ended .ss-ctrl { opacity: 1; }

/* Sân khấu và các lớp slide */
.ss-stage { position: relative; overflow: hidden; perspective: 1600px; }
.ss-layer { position: absolute; inset: 0; display: flex; flex-direction: column; transition: opacity var(--ss-ms) ease, transform var(--ss-ms) cubic-bezier(.65, 0, .35, 1), filter var(--ss-ms) ease, clip-path var(--ss-ms) cubic-bezier(.65, 0, .35, 1); backface-visibility: hidden; will-change: opacity, transform; }
.ss-layer.leave { pointer-events: none; z-index: 0; }
.ss-layer.active { z-index: 1; }
.ss-media { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.ss-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(36px) brightness(.45) saturate(1.2); transform: scale(1.1); }
.ss-img { position: relative; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); animation: ss-kenburns var(--ss-dur, 6s) linear forwards; transform-origin: 50% 50%; }
.ss-root.paused .ss-img { animation-play-state: paused; }
@keyframes ss-kenburns { from { transform: scale(1); } to { transform: scale(1.05); } }
.ss-err, .ss-empty { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 10px; color: rgba(244, 246, 251, .8); text-align: center; padding: 24px; }
.ss-err[hidden] { display: none; }
.ss-err svg, .ss-empty svg { width: 40px; height: 40px; color: #fbbf24; }
.ss-empty { position: absolute; inset: 0; justify-content: center; }
.ss-empty b { font-size: 20px; }

.ss-cap { flex: none; display: flex; align-items: flex-start; gap: 14px; padding: 14px clamp(18px, 4vw, 64px) 16px; background: linear-gradient(180deg, rgba(5, 7, 13, .2), rgba(5, 7, 13, .9)); }
.ss-cap p { margin: 0; font-size: clamp(16px, 1.6vw, 24px); line-height: 1.5; font-weight: 600; max-width: 75ch; text-wrap: pretty; }
.ss-cap-tag { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: rgba(96, 165, 250, .2); color: #bfdbfe; font-weight: 800; font-size: 13px; margin-top: 3px; }
.ss-cap-tag.video { background: rgba(251, 191, 36, .2); color: #fde68a; }
.ss-cap-tag svg { width: 15px; height: 15px; }

.ss-yt { position: relative; width: min(100%, calc((100dvh - 230px) * 16 / 9)); aspect-ratio: 16 / 9; max-height: 100%; background: #000; border-radius: 10px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.ss-yt iframe, .ss-yt .ss-yt-host { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ss-yt-poster { position: absolute; inset: 0; background-size: cover; background-position: center; display: grid; place-items: center; transition: opacity .4s; pointer-events: none; }
.ss-layer.playing .ss-yt-poster { opacity: 0; }
.ss-yt .ss-err { position: absolute; inset: 0; justify-content: center; background: rgba(0, 0, 0, .75); }
.ss-spin { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: ss-spin 0.9s linear infinite; }
@keyframes ss-spin { to { transform: rotate(360deg); } }

.ss-intro-card { position: relative; width: min(920px, calc(100% - 48px)); max-height: calc(100% - 32px); overflow: auto; padding: clamp(24px, 4vw, 48px); border-radius: 22px; background: linear-gradient(160deg, rgba(124, 58, 237, .25), rgba(37, 99, 235, .18)); border: 1px solid rgba(255, 255, 255, .12); }
.ss-intro-eyebrow { margin: 0 0 8px; display: inline-flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 1.2px; font-size: 13px; font-weight: 800; color: #c4b5fd; }
.ss-intro-eyebrow svg { width: 16px; height: 16px; }
.ss-intro-card h2 { margin: 0 0 16px; font-size: clamp(28px, 3.6vw, 48px); line-height: 1.15; display: flex; align-items: center; gap: 14px; text-wrap: balance; }
.ss-intro-emoji { font-size: 1.1em; }
.ss-intro-text { font-size: clamp(17px, 1.7vw, 24px); line-height: 1.65; color: rgba(244, 246, 251, .92); }
.ss-intro-text p { margin: 0 0 .8em; }

/* Hiệu ứng chuyển cảnh: .enter = trạng thái bắt đầu của slide mới, .leave = trạng thái kết thúc của slide cũ */
.ss-layer.t-none { transition: none; }
.ss-layer.t-none.leave { opacity: 0; }
.ss-layer.t-fade.enter, .ss-layer.t-fade.leave { opacity: 0; }
.ss-layer.t-slide.enter[data-dir="fwd"], .ss-layer.t-slide.leave[data-dir="back"] { transform: translateX(100%); }
.ss-layer.t-slide.enter[data-dir="back"], .ss-layer.t-slide.leave[data-dir="fwd"] { transform: translateX(-100%); }
.ss-layer.t-zoom.enter { opacity: 0; transform: scale(1.18); }
.ss-layer.t-zoom.leave { opacity: 0; transform: scale(.88); }
.ss-layer.t-flip.enter[data-dir="fwd"], .ss-layer.t-flip.leave[data-dir="back"] { opacity: 0; transform: rotateY(-75deg) scale(.9); }
.ss-layer.t-flip.enter[data-dir="back"], .ss-layer.t-flip.leave[data-dir="fwd"] { opacity: 0; transform: rotateY(75deg) scale(.9); }
.ss-layer.t-blur.enter, .ss-layer.t-blur.leave { opacity: 0; filter: blur(28px); }
.ss-layer.t-rise.enter { opacity: 0; transform: translateY(14%); }
.ss-layer.t-rise.leave { opacity: 0; transform: translateY(-8%); }
.ss-layer.t-slidev.enter[data-dir="fwd"], .ss-layer.t-slidev.leave[data-dir="back"] { transform: translateY(100%); }
.ss-layer.t-slidev.enter[data-dir="back"], .ss-layer.t-slidev.leave[data-dir="fwd"] { transform: translateY(-100%); }

/* Kiểu "lộ dần": slide mới phủ lên slide cũ theo hình cắt, slide cũ đứng yên bên dưới */
.ss-layer.t-wipe, .ss-layer.t-circle, .ss-layer.t-diamond { background: #05070d; }
.ss-layer.t-wipe { clip-path: inset(0 0 0 0); }
.ss-layer.t-wipe.enter[data-dir="fwd"] { clip-path: inset(0 0 0 100%); }
.ss-layer.t-wipe.enter[data-dir="back"] { clip-path: inset(0 100% 0 0); }
.ss-layer.t-circle { clip-path: circle(75% at 50% 50%); }
.ss-layer.t-circle.enter { clip-path: circle(0% at 50% 50%); }
.ss-layer.t-diamond { clip-path: polygon(50% -50%, 150% 50%, 50% 150%, -50% 50%); }
.ss-layer.t-diamond.enter { clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%); }
.ss-layer.t-wipe.leave, .ss-layer.t-circle.leave, .ss-layer.t-diamond.leave { filter: brightness(.55); }

.ss-layer.t-cube.enter[data-dir="fwd"] { transform-origin: 0% 50%; transform: translateX(100%) rotateY(90deg); filter: brightness(.6); }
.ss-layer.t-cube.leave[data-dir="fwd"] { transform-origin: 100% 50%; transform: translateX(-100%) rotateY(-90deg); filter: brightness(.6); }
.ss-layer.t-cube.enter[data-dir="back"] { transform-origin: 100% 50%; transform: translateX(-100%) rotateY(-90deg); filter: brightness(.6); }
.ss-layer.t-cube.leave[data-dir="back"] { transform-origin: 0% 50%; transform: translateX(100%) rotateY(90deg); filter: brightness(.6); }
.ss-layer.t-cube.active[data-dir="fwd"] { transform-origin: 0% 50%; }
.ss-layer.t-cube.active[data-dir="back"] { transform-origin: 100% 50%; }

.ss-layer.t-spin.enter { opacity: 0; transform: rotate(-14deg) scale(.55); }
.ss-layer.t-spin.leave { opacity: 0; transform: rotate(14deg) scale(1.35); }
.ss-layer.t-zoomout.enter { opacity: 0; transform: scale(.6); }
.ss-layer.t-zoomout.leave { opacity: 0; transform: scale(1.45); }

/* Mờ qua đen: slide cũ tắt hẳn trong nửa đầu, slide mới hiện lên trong nửa sau */
.ss-layer.t-dip { transition: opacity calc(var(--ss-ms) / 2) ease; }
.ss-layer.t-dip.active { transition-delay: calc(var(--ss-ms) / 2); }
.ss-layer.t-dip.enter, .ss-layer.t-dip.leave { opacity: 0; }

/* Màn hình kết thúc */
dialog.ss-player .ss-end { position: absolute; inset: 0; grid-row: 2; grid-column: 1; z-index: 5; display: grid; place-items: center; background: rgba(5, 7, 13, .82); backdrop-filter: blur(6px); }
dialog.ss-player .ss-end[hidden] { display: none; }
.ss-end-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px; }
.ss-end-ico { width: 72px; height: 72px; border-radius: 22px; background: #7c3aed; display: grid; place-items: center; }
.ss-end-ico svg { width: 36px; height: 36px; }
.ss-end h2 { margin: 6px 0 0; font-size: 30px; }
.ss-end-sub { margin: 0; color: rgba(244, 246, 251, .7); font-size: 16px; }
.ss-end-acts { display: flex; gap: 10px; margin-top: 12px; }
.ss-pill { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 99px; border: 1.5px solid rgba(255, 255, 255, .25); background: transparent; color: #fff; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.ss-pill:hover { background: rgba(255, 255, 255, .12); }
.ss-pill.primary { background: #fff; color: #05070d; border-color: #fff; }
.ss-pill.primary:hover { background: #e6ebf5; }
.ss-pill svg { width: 18px; height: 18px; }

@media (max-width: 640px) {
  .ss-top { padding: 8px 10px 6px; }
  .ss-ctrl { padding: 8px 10px 10px; gap: 8px; }
  .ss-btn { width: 40px; height: 40px; }
  .ss-play { width: 48px; height: 48px; }
  .ss-volw input { width: 70px; }
  .ss-time { display: none; }
  .ss-cap { flex-direction: column; gap: 6px; }
  .ss-yt { width: 100%; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ss-img { animation: none; }
  .ss-layer { transform: none !important; filter: none !important; }
}

/* ----- Nền slide mở đầu (dùng chung cho xem trước và trình phát) ----- */
.ss-ibg { position: absolute; inset: 0; overflow: hidden; background: #05070d; }
.ss-ibg canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ss-ibg.is-default { background: radial-gradient(120% 90% at 20% 10%, rgba(124, 58, 237, .28), transparent 60%), radial-gradient(100% 80% at 90% 90%, rgba(37, 99, 235, .25), transparent 60%), #05070d; }
.ss-ibg-img { position: absolute; inset: -3%; background-size: cover; background-position: center; animation: ss-ibg-kb 26s ease-in-out infinite alternate; }
.ss-ibg.blur .ss-ibg-img { inset: -6%; filter: blur(8px) saturate(1.15); }
.ss-ibg-dim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5, 7, 13, calc(var(--ss-ibg-dim, .45) * .7)), rgba(5, 7, 13, var(--ss-ibg-dim, .45))); }
.ss-ibg.broken .ss-ibg-img { background: linear-gradient(135deg, #1e293b, #0f172a) !important; }
@keyframes ss-ibg-kb { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.08) translate(-1.5%, -1%); } }

/* Trình phát: thẻ nội dung kiểu kính mờ trên nền */
.ss-intro-media .ss-intro-card { z-index: 1; }
.ss-intro-media.has-bg .ss-intro-card { background: rgba(8, 11, 24, .52); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); border-color: rgba(255, 255, 255, .18); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.ss-layer.active .ss-intro-card { animation: ss-intro-in .9s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--ss-ms) * .4); }
@keyframes ss-intro-in { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }

/* Trình xây dựng */
.ss-ibg-box.off .ss-ibg-layout { opacity: .62; }
.ss-ibg-offnote { display: none; background: #fff7e6; border: 1px solid #fde3a7; color: #8a5a00; padding: 8px 12px; border-radius: 10px; }
.ss-ibg-box.off .ss-ibg-offnote { display: block; }
.ss-ibg-layout { display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; transition: opacity .2s; }
.ss-ibg-side { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 8px; }
.ss-ibg-pick { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ss-ibg-pick > .pd-label { margin: 4px 0 0; }
.ss-ibg-preview { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; display: grid; place-items: center; padding: 14px; box-shadow: 0 10px 30px rgba(15, 23, 42, .25); container-type: inline-size; }
.ss-ibg-card { position: relative; z-index: 1; width: 88%; max-height: 82%; overflow: hidden; padding: 6% 7%; border-radius: 12px; color: #f4f6fb; background: linear-gradient(160deg, rgba(124, 58, 237, .25), rgba(37, 99, 235, .18)); border: 1px solid rgba(255, 255, 255, .14); display: flex; flex-direction: column; gap: 4px; }
.ss-ibg-preview.has-bg .ss-ibg-card { background: rgba(8, 11, 24, .52); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-color: rgba(255, 255, 255, .2); }
.ss-ibg-card small { text-transform: uppercase; letter-spacing: 1px; font-size: 9px; font-weight: 800; color: #c4b5fd; }
.ss-ibg-card b { font-size: clamp(14px, 6cqi, 22px); line-height: 1.2; }
.ss-ibg-card p { margin: 0; font-size: clamp(10px, 3.4cqi, 13px); line-height: 1.5; color: rgba(244, 246, 251, .9); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ss-ibg-imgopts { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel2, #f6f8fc); }
.ss-ibg-imgopts[hidden] { display: none; }

.ss-ibg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.ss-ibg-opt { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.ss-ibg-opt:hover { border-color: #c9b5f7; transform: translateY(-1px); }
.ss-ibg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.ss-ibg-opt:has(input:checked) { border-color: #7c3aed; background: #f6f1ff; box-shadow: 0 0 0 3px rgba(124, 58, 237, .16); }
.ss-ibg-opt:has(input:checked)::after { content: ""; position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; border-radius: 50%; background: #7c3aed url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 12px no-repeat; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.ss-ibg-opt:has(input:focus-visible) { outline: 2.5px solid #7c3aed; outline-offset: 2px; }
.ss-ibg-thumb { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: #0f172a; }
.ss-ibg-thumb canvas, .ss-ibg-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.ss-ibg-thumb.is-default { background: radial-gradient(120% 90% at 20% 10%, rgba(124, 58, 237, .55), transparent 60%), radial-gradient(100% 80% at 90% 90%, rgba(37, 99, 235, .5), transparent 60%), #05070d; }
.ss-ibg-thumb.broken img { display: none; }
.ss-ibg-thumb.broken::after { content: "Không tải được ảnh"; position: absolute; inset: 0; display: grid; place-items: center; color: #cbd5e1; font-size: 11px; font-weight: 700; text-align: center; padding: 4px; }
.ss-ibg-lbl { font-size: 12.5px; font-weight: 700; color: var(--pd-ink, #1e293b); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-ibg-opt.point .ss-ibg-lbl, .ss-ibg-opt.url .ss-ibg-lbl { color: #6d28d9; }
.ss-ibg-urlrow { display: flex; gap: 8px; }
.ss-ibg-urlrow .pd-input { flex: 1; min-width: 0; }
.ss-ibg-urlrow .btn { flex: none; }
.ss-ibg-urlrow svg { width: 16px; height: 16px; }

@media (max-width: 860px) {
  .ss-ibg-layout { grid-template-columns: 1fr; }
  .ss-ibg-side { position: static; }
}
@media (max-width: 480px) {
  .ss-ibg-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .ss-ibg-urlrow { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .ss-ibg-img, .ss-layer.active .ss-intro-card { animation: none; }
}

/* ----- Âm thanh riêng từng slide: nhạc, giọng đọc, tắt tiếng video ----- */
.ss-voice-box .pd-help { margin: 0; }
.ss-voice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.ss-voice-grid .ss-unit .pd-input { width: 84px; }
.ss-voice-box [data-ss="tts-all"]:disabled { opacity: .5; cursor: not-allowed; }

.ss-snd { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 0 2px; margin-top: 2px; border-top: 1px dashed var(--line); }
.ss-snd-f { display: inline-flex; align-items: center; gap: 6px; color: #7c3aed; min-width: 0; }
.ss-snd-f svg { width: 16px; height: 16px; flex: none; }
.ss-snd-f .pd-input { width: auto; max-width: 260px; padding: 6px 8px; font-size: 13px; }
.ss-check.sm { font-size: 13px; font-weight: 700; gap: 7px; }
.ss-check.sm input { width: 16px; height: 16px; }
.ss-snd [data-vgen][hidden], .ss-snd [data-vplay][hidden], .ss-vstat[hidden] { display: none; }
.ss-snd [data-vgen]:disabled { opacity: .55; cursor: not-allowed; }
.ss-vplay.on { color: #7c3aed; }

.ss-vstat { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.ss-vstat svg { width: 14px; height: 14px; flex: none; }
.ss-vstat[data-state="ok"] { color: #047857; }
.ss-vstat[data-state="stale"] { color: #b45309; }
.ss-vstat[data-state="err"] { color: #be123c; }
.ss-vstat[data-state="busy"] { color: #6d28d9; }
.ss-mini-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: ss-spin-mini .8s linear infinite; flex: none; }
@keyframes ss-spin-mini { to { transform: rotate(360deg); } }

.ss-intro-snd { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #faf8ff; }
.ss-intro-snd:empty { display: none; }
.ss-intro-snd .ss-snd { border-top: 0; padding-top: 0; }
.ss-intro-snd-t { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 800; color: var(--pd-ink); }
.ss-intro-snd-t svg { width: 16px; height: 16px; color: #7c3aed; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ss-snd svg, .ss-vstat svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Trình phát: chỉ báo "Đang đọc mô tả" + thanh âm lượng giọng đọc */
.ss-speaking { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: rgba(167, 139, 250, .2); color: #ddd6fe; font-size: 13px; font-weight: 700; }
.ss-speaking[hidden] { display: none; }
dialog.ss-player .ss-speaking svg { width: 16px; height: 16px; animation: ss-speak 1.2s ease-in-out infinite; }
@keyframes ss-speak { 50% { opacity: .45; } }
.ss-volw-voice input { accent-color: #34d399; }

@media (max-width: 860px) {
  .ss-voice-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .ss-voice-grid { grid-template-columns: 1fr; }
  .ss-snd-f .pd-input { max-width: 200px; }
  .ss-speaking span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  dialog.ss-player .ss-speaking svg, .ss-mini-spin { animation: none; }
}

/* Độ dài giọng đọc + nút khớp thời lượng slide */
.ss-vdur { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ss-vdur[hidden], .ss-vdur [data-vfit][hidden] { display: none; }
.ss-vdur-t { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ss-vdur-t svg { width: 14px; height: 14px; flex: none; }
.ss-vdur[data-state="ok"] .ss-vdur-t { background: #ecfdf5; color: #047857; }
.ss-vdur[data-state="short"] .ss-vdur-t { background: #fff7ed; color: #b45309; }
.ss-vfit svg { width: 14px; height: 14px; }
