/* Official-YouTube series in Roya's wrap (js/ytshows.js).
   Roya's chrome sits AROUND the YouTube player (bar above, side/bottom panel beside it); nothing
   is drawn over the embed, so YouTube's controls, logo and ads stay visible and clickable. */
.player.is-ytshow .p-ui, .player.is-ytshow .p-error, .player.is-ytshow .zap { display: none; }
.yts { position: absolute; inset: 0; z-index: 3; display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) auto; background: #000; }

/* title bar */
.yts-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px clamp(10px, 2vw, 24px);
  padding-top: max(8px, env(safe-area-inset-top)); background: linear-gradient(180deg, var(--ink-2, #11141c), var(--ink-0, #050609)); border-bottom: 1px solid var(--line, rgba(255,255,255,.08)); }
.yts-back { color: #fff; flex: none; }
.yts-titles { flex: 1; min-width: 0; }
.yts-titles h1 { margin: 0; font-size: clamp(1rem, 0.9rem + 0.4vw, 1.2rem); font-weight: 700; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yts-titles p { margin: 2px 0 0; color: var(--text-2, #b9bdc9); font-size: var(--fs-s, .9rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yts-btn { flex: none; gap: 8px; }
.yts-btn svg, .yts-btn i { width: 18px; height: 18px; }

/* the YouTube player's area */
.yts-stage { position: relative; grid-row: 2; grid-column: 1; min-width: 0; min-height: 0; background: #000; }
.yts-stage .yts-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity .35s var(--ease, ease); z-index: 1; }
.yts-stage .yts-frame.on { opacity: 1; }
.yts-veil { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; align-content: center; gap: 14px; background: #000; transition: opacity .35s ease; }
.yts-veil img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(24px) brightness(.45); transform: scale(1.1); }
.yts-veil .p-spinner { position: relative; opacity: 1; }
.yts-veil .yts-slow { position: relative; color: var(--text-2, #b9bdc9); font-size: var(--fs-s, .9rem); opacity: 0; transition: opacity .3s; }
.yts-veil.slow .yts-slow { opacity: 1; }
.yts-veil.off { opacity: 0; pointer-events: none; }

/* Roya error message (replaces the embed; never drawn over a working one) */
.yts-err { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px; text-align: center;
  background: radial-gradient(60% 60% at 50% 40%, rgba(225,29,42,.14), transparent 70%), #050609; }
.yts-err > div { max-width: 460px; display: grid; justify-items: center; gap: 10px; }
.yts-err svg, .yts-err i { width: 44px; height: 44px; color: var(--red, #e11d2a); }
.yts-err h3 { margin: 4px 0 0; font-size: 1.25rem; }
.yts-err p { margin: 0; color: var(--text-2, #b9bdc9); line-height: 1.8; }
.yts-err-act, .yts-un-act { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }

/* side panel: episode drawer / up-next card. It takes room from the player instead of covering it. */
.yts-side { grid-row: 2; grid-column: 2; width: min(400px, 36vw); min-height: 0; display: flex; flex-direction: column; background: var(--ink-1, #0a0c12);
  border-inline-start: 1px solid var(--line, rgba(255,255,255,.08)); animation: ytsIn .28s var(--ease, ease) both; }
.yts-side[hidden] { display: none; }
@keyframes ytsIn { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 24px)); } }
[dir="rtl"] .yts-side { --dir: -1; }
.yts-drawer > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 10px; }
.yts-drawer > header h2 { margin: 0; font-size: 1.1rem; }
.yts-drawer > header p { margin: 2px 0 0; color: var(--text-3, #7d8394); font-size: var(--fs-s, .9rem); }
.yts-drawer .eps-seasons { margin: 0 16px 10px; align-self: flex-start; max-width: calc(100% - 32px); overflow-x: auto; }
.yts-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 16px; }
.yts-drawer .eps-row { grid-template-columns: 26px 120px 1fr; gap: 12px; padding: 10px 8px; border-radius: 10px; }
.yts-drawer .eps-n { font-size: 1rem; }
.yts-drawer .eps-top { flex-direction: column; gap: 0; }
.yts-drawer .eps-top b { font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.yts-row.is-current { background: rgba(225,29,42,.12); }
.yts-row.is-current .eps-thumb { box-shadow: 0 0 0 2px var(--red, #e11d2a); }

.yts-upnext { justify-content: center; }
.yts-un { display: grid; gap: 10px; padding: 22px; }
.yts-un-k { color: var(--red-2, #ff3b47); font-weight: 700; font-size: var(--fs-s, .9rem); font-variant-numeric: tabular-nums; }
.yts-un-thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #15161d; box-shadow: 0 0 0 1px rgba(255,255,255,.1); }
.yts-un-thumb img { width: 100%; height: 100%; object-fit: cover; }
.yts-un-thumb i { position: absolute; inset: auto 0 0 0; height: 4px; background: var(--red, #e11d2a); transform-origin: var(--from, left); animation: ytsCount var(--d, 10s) linear both; }
[dir="rtl"] .yts-un-thumb i { --from: right; }
@keyframes ytsCount { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.yts-un h3 { margin: 4px 0 0; font-size: 1.05rem; line-height: 1.6; }
.yts-un p { margin: 0; color: var(--text-3, #7d8394); font-size: var(--fs-s, .9rem); }
.yts-un .yts-un-act { justify-content: flex-start; }

/* title page list */
.yts-eps .eps-thumb img { transition: transform .4s var(--ease, ease); }
.yts-eps .eps-row:hover .eps-thumb img { transform: scale(1.04); }

/* Home "Continue watching": which episode */
.pcard:has(.yts-cont-chip) .rp-chip { display: none; } /* the episode chip takes the badge's corner */
.yts-cont-chip { position: absolute; inset-inline-start: 8px; top: 8px; z-index: 3; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px;
  background: rgba(5,6,9,.78); color: #fff; font-size: 11px; font-weight: 600; line-height: 1.4; }
.yts-cont-chip svg, .yts-cont-chip i { width: 11px; height: 11px; }

/* phones / narrow: the panel sits under the player */
@media (max-width: 760px) {
  .yts { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .yts-bar { gap: 8px; min-height: 56px; }
  .yts-btn span { display: none; }
  .yts-btn { width: 40px; padding: 0; justify-content: center; }
  .yts-side { grid-row: 3; grid-column: 1; width: auto; height: 56vh; border-inline-start: 0; border-top: 1px solid var(--line, rgba(255,255,255,.08)); --dir: 0; }
  .yts-upnext { height: auto; max-height: 56vh; }
  .yts-drawer .eps-row { grid-template-columns: 112px 1fr; }
  .yts-un { grid-template-columns: 132px 1fr; align-items: center; gap: 6px 14px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
  .yts-un-k, .yts-un .yts-un-act { grid-column: 1 / -1; }
  .yts-un-thumb { grid-row: 2 / span 2; }
  .yts-un h3 { margin: 0; font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) { .yts-side { animation: none; } .yts-un-thumb i { animation: none; transform: none; } }

/* A film's official trailer in the Roya player: same screen as everything else, no episode controls */
.yts.yts-trailer [data-yts="drawer"], .yts.yts-trailer [data-yts="next"] { display: none; }
