html.pfx { --pfx-accent: 244, 197, 104; }
html.pfx.night-mode { --pfx-accent: 178, 198, 250; }

html.pfx .project-dialog { isolation: isolate; }
html.pfx .project-dialog[open] { animation: pfx-open .5s cubic-bezier(.2, .9, .3, 1.05) both; }
html.pfx .project-dialog[open]::backdrop { animation: pfx-fade .35s ease both; }
html.pfx .project-dialog.pfx-closing { animation: pfx-close .22s ease forwards; }
html.pfx .project-dialog.pfx-closing::backdrop { animation: pfx-fade .22s ease reverse forwards; }
@keyframes pfx-open { from { opacity: 0; transform: translateY(22px) scale(.965); } }
@keyframes pfx-close { to { opacity: 0; transform: translateY(12px) scale(.975); } }
@keyframes pfx-fade { from { opacity: 0; } }

.pfx-ambient {
  position: absolute; left: 0; right: 0; top: 0; height: 380px; z-index: -1; pointer-events: none; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 20%, transparent); mask-image: linear-gradient(#000 20%, transparent);
  opacity: 0; transition: opacity .8s ease;
}
.pfx-ambient.is-on { opacity: 1; }
.pfx-ambient img { width: 100%; height: 100%; object-fit: cover; filter: blur(48px) saturate(1.5); opacity: .32; transform: scale(1.35); animation: pfx-drift 18s ease-in-out infinite alternate; }
html.night-mode .pfx-ambient img { opacity: .26; filter: blur(48px) saturate(1.2); }
@keyframes pfx-drift { from { transform: scale(1.35) translate(-2%, -2%); } to { transform: scale(1.5) translate(2%, 2%); } }

html.pfx #project-detail > * { animation: pfx-rise .6s cubic-bezier(.2, .7, .2, 1) both; }
html.pfx #project-detail > :nth-child(2) { animation-delay: .08s; }
html.pfx #project-detail > :nth-child(3) { animation-delay: .14s; }
html.pfx #project-detail > :nth-child(4) { animation-delay: .2s; }
html.pfx #project-detail > :nth-child(5) { animation-delay: .26s; }
html.pfx #project-detail > :nth-child(n+6) { animation-delay: .32s; }
html.pfx .detail-heading > div:last-child > * { animation: pfx-rise .6s cubic-bezier(.2, .7, .2, 1) both; }
html.pfx .detail-heading > div:last-child > :nth-child(2) { animation-delay: .07s; }
html.pfx .detail-heading > div:last-child > :nth-child(3) { animation-delay: .13s; }
html.pfx .detail-heading > div:last-child > :nth-child(n+4) { animation-delay: .19s; }
@keyframes pfx-rise { from { opacity: 0; transform: translateY(12px); filter: blur(4px); } }

html.pfx .detail-heading { perspective: 800px; }
html.pfx .detail-poster {
  position: relative; animation: pfx-poster .8s cubic-bezier(.2, .8, .2, 1) both;
  box-shadow: 0 18px 34px -16px rgba(0, 0, 0, .85), 0 0 0 1px rgba(var(--pfx-accent), .18);
  transform: rotateX(var(--pfx-rx, 0deg)) rotateY(var(--pfx-ry, 0deg)); transition: transform .5s cubic-bezier(.2, .7, .2, 1), box-shadow .3s;
}
html.pfx .detail-poster.is-tilting { transition: transform .08s linear, box-shadow .3s; box-shadow: 0 22px 40px -16px rgba(0, 0, 0, .9), 0 0 0 1px rgba(var(--pfx-accent), .45), 0 0 26px rgba(var(--pfx-accent), .2); }
html.pfx .detail-poster::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(circle at var(--pfx-gx, 50%) var(--pfx-gy, 30%), rgba(255, 255, 255, .28), transparent 55%); mix-blend-mode: soft-light;
}
html.pfx .detail-poster.is-tilting::after { opacity: 1; }
@keyframes pfx-poster { from { opacity: 0; transform: translateX(-18px) rotateY(18deg) scale(.94); } }

html.pfx .voice-tag svg { animation: pfx-pop .5s cubic-bezier(.3, 1.5, .5, 1) .45s both; }
html.pfx .voice-tag + .voice-tag svg { animation-delay: .55s; }
@keyframes pfx-pop { from { transform: scale(0) rotate(-45deg); } }

html.pfx .episode-progress-fill { position: relative; overflow: hidden; }
html.pfx .episode-progress-fill::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent);
  transform: translateX(-100%); animation: pfx-sheen 2.8s ease-in-out 1.2s infinite;
}
@keyframes pfx-sheen { 55%, 100% { transform: translateX(100%); } }

html.pfx .release-mode-switch { position: relative; isolation: isolate; }
.pfx-thumb {
  position: absolute; z-index: -1; border-radius: 9px; pointer-events: none; background: #efc66f;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .2), inset 0 1px rgba(255, 255, 255, .33);
  transition: left .45s cubic-bezier(.3, 1.3, .5, 1), width .45s cubic-bezier(.3, 1.3, .5, 1);
}
html.pfx .release-mode-button.active, html.pfx .release-mode-button.active:hover { background: transparent; box-shadow: none; }

html.pfx .project-credits .credit-member-link { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .35s ease, color .2s; }
html.pfx .project-credits .credit-member-link:hover { background-size: 100% 1px; }

html.pfx .watch-links > a { transition: transform .25s cubic-bezier(.2, .7, .2, 1), background .2s, box-shadow .25s; }
html.pfx .watch-links > a:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -10px rgba(var(--pfx-accent), .55); }
html.pfx .player-start .gold-button { animation: pfx-glow 2.4s ease-in-out infinite; }
@keyframes pfx-glow { 50% { box-shadow: 0 0 0 6px rgba(var(--pfx-accent), .12), 0 0 26px rgba(var(--pfx-accent), .35); } }

html.pfx.night-mode .project-dialog { background: #121827; border-color: #2c3a58; }
html.pfx.night-mode .project-credits { background: #172036; border-color: #2c3a58; }
html.pfx.night-mode .project-credit-row dt { color: #b9c7ef; }
html.pfx.night-mode .project-credit-row dd { color: #c9d2e6; }
html.pfx.night-mode .release-format { background: #151d30; border-color: #2c3a58; }
html.pfx.night-mode .release-mode-switch { background: #0f1522; border-color: #2c3a58; }
html.pfx.night-mode .episode-row select { background: #172036; border-color: #2c3a58; }
html.pfx.night-mode .studio-support { border-color: #2c3a58; }
html.pfx.night-mode .studio-support-button { border-color: #34446a; color: #a9b8dc; }
html.pfx.night-mode .detail-poster { background: #1a2338; }

@media (prefers-reduced-motion: reduce) {
  html.pfx .project-dialog[open], html.pfx .project-dialog[open]::backdrop, html.pfx #project-detail > *, html.pfx .detail-heading > div:last-child > *,
  html.pfx .detail-poster, html.pfx .voice-tag svg, html.pfx .episode-progress-fill::after, .pfx-ambient img, html.pfx .player-start .gold-button { animation: none !important; }
  .pfx-thumb { transition: none; }
}
