/* PurePlay — player styles (loaded into the player's shadow root and the options preview). */
:host { all: initial; }

.pp {
  --pp-accent: #38bdf8;
  --pp-accent-2: #818cf8;
  --pp-fg: #fff;
  --pp-panel: rgba(24, 24, 28, 0.92);
  --pp-line: rgba(255, 255, 255, 0.14);
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: var(--pp-fg);
  font-family: var(--pp-ui-font, "Vazirmatn", system-ui, sans-serif);
  font-size: 14px;
  line-height: 1.4;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  container-type: size;
  contain: strict;
}
.pp[data-mode="page"], .pp.pp-adopted { background: #000; }
.pp:not(.pp-show):not(.pp-paused):not(.pp-menu-open) { cursor: none; }
.pp *, .pp *::before, .pp *::after { box-sizing: border-box; }
.pp [hidden] { display: none !important; }

.pp-ico { width: 24px; height: 24px; fill: currentColor; display: block; flex: none; }

/* ------------------------------------------------------------------ stage */
.pp-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pp-stage > video {
  position: static !important; inset: auto !important; margin: 0 !important; padding: 0 !important;
  width: 100% !important; height: 100% !important; max-width: none !important; max-height: none !important;
  min-width: 0 !important; min-height: 0 !important; border: 0 !important; border-radius: 0 !important;
  display: block !important; visibility: visible !important; opacity: 1 !important; background: #000;
  transform-origin: center center;
}

/* ------------------------------------------------------------------ subtitles */
.pp-subs { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.pp-sub-layer { position: absolute; inset: 0; }
.pp-sub-frame { position: absolute; }
.pp-sub-frame.pp-ass { overflow: hidden; }
.pp-stack {
  position: absolute; left: 0; right: 0; display: flex; flex-direction: column; gap: 0.12em;
  padding-left: 4%; padding-right: 4%; transition: transform 0.2s ease;
}
.pp-stack-bottom { bottom: 0; justify-content: flex-end; }
.pp-stack-top { top: 0; }
.pp-stack-mid { top: 50%; transform: translateY(-50%); }
.pp-col-left { align-items: flex-start; text-align: left; }
.pp-col-center { align-items: center; text-align: center; }
.pp-col-right { align-items: flex-end; text-align: right; }
.pp-ass .pp-stack { padding-left: 0; padding-right: 0; gap: 0; }
.pp-cue { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; text-align: inherit; }
.pp-line { display: block; }
.pp-box {
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  padding: 0.04em 0.32em; border-radius: 0.16em;
}
.pp-ass-ev { white-space: pre-wrap; overflow-wrap: break-word; line-height: 1.18; }
.pp-ass-ev .pp-line { white-space: inherit; }
.pp-bitmap { position: absolute; }

/* ------------------------------------------------------------------ layers */
.pp-gesture { position: absolute; inset: 0; z-index: 3; }

.pp-big-play {
  position: absolute; z-index: 4; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px;
  border-radius: 50%; border: 0; cursor: pointer; color: #fff; display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px); box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, background 0.15s;
}
.pp-big-play .pp-ico { width: 40px; height: 40px; margin-inline-start: 4px; }
.pp-big-play:hover { transform: scale(1.06); background: var(--pp-accent); }
.pp.pp-paused:not(.pp-loading) .pp-big-play { display: flex; }
.pp[data-mode="overlay"]:not(.pp-adopted).pp-paused .pp-big-play { display: flex; }

.pp-spinner { position: absolute; z-index: 4; left: 50%; top: 50%; margin: -24px 0 0 -24px; display: none; }
.pp.pp-loading .pp-spinner { display: block; }
.pp-spin {
  width: 48px; height: 48px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.2); border-top-color: var(--pp-accent);
  animation: pp-spin 0.8s linear infinite;
}
@keyframes pp-spin { to { transform: rotate(360deg); } }

.pp-osd {
  position: absolute; z-index: 6; left: 50%; top: 18%; transform: translate(-50%, 6px); opacity: 0;
  padding: 8px 18px; border-radius: 999px; background: rgba(0, 0, 0, 0.7); font-size: 16px; font-weight: 600;
  pointer-events: none; transition: opacity 0.18s, transform 0.18s; white-space: nowrap; direction: ltr; unicode-bidi: isolate;
}
.pp-osd.pp-on { opacity: 1; transform: translate(-50%, 0); }
.pp-osd.pp-osd-icon { top: 50%; margin-top: -32px; padding: 14px; }
.pp-osd.pp-osd-icon .pp-ico { width: 36px; height: 36px; }

.pp-error {
  position: absolute; z-index: 7; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, 88%);
  background: var(--pp-panel); border: 1px solid var(--pp-line); border-radius: 14px; padding: 18px 20px; text-align: center;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.pp-error-title { font-size: 16px; font-weight: 700; }
.pp-error-msg { opacity: 0.75; font-size: 13px; direction: ltr; unicode-bidi: plaintext; word-break: break-word; }

/* ------------------------------------------------------------------ chrome */
.pp-top, .pp-bottom { position: absolute; left: 0; right: 0; z-index: 5; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.pp.pp-show .pp-top, .pp.pp-show .pp-bottom, .pp.pp-paused .pp-bottom, .pp.pp-menu-open .pp-bottom { opacity: 1; pointer-events: auto; }
.pp.pp-paused .pp-top { opacity: 1; pointer-events: auto; }

.pp-top {
  top: 0; display: flex; align-items: center; gap: 10px; padding: 10px 14px 28px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent);
}
.pp-brand { color: var(--pp-accent); display: flex; }
.pp-brand .pp-ico { width: 22px; height: 22px; }
.pp-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; font-weight: 600; unicode-bidi: plaintext; text-align: left; }
.pp[dir="rtl"] .pp-title { text-align: right; }
.pp-top-actions { display: flex; gap: 2px; }
.pp[data-mode="overlay"]:not(.pp-adopted) .pp-top { padding-top: 6px; }

.pp-bottom { bottom: 0; padding: 30px 12px 4px; background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.35) 60%, transparent); }

.pp-progress { position: relative; height: 20px; display: flex; align-items: center; cursor: pointer; touch-action: none; margin: 0 4px; }
.pp-rail {
  position: relative; width: 100%; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); transition: height 0.12s ease;
}
.pp-progress:hover .pp-rail, .pp.pp-scrubbing .pp-rail { height: 9px; }
.pp-played, .pp-abrange { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; border-radius: inherit; }
.pp-ranges { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.pp-range-seg { position: absolute; top: 0; bottom: 0; border-radius: inherit; }
/* saved by the download cache (seeking there needs no download): a blue strip under the bar */
.pp-ranges.pp-cached { inset: auto 0 -6px 0; height: 3px; border-radius: 3px; overflow: visible; }
.pp-cached .pp-range-seg { background: var(--pp-accent); box-shadow: 0 0 6px rgba(56, 189, 248, 0.6); }
/* buffered by the browser, ready to play */
.pp-buf .pp-range-seg { background: rgba(255, 255, 255, 0.62); }
.pp-played { background: linear-gradient(90deg, var(--pp-accent-2), var(--pp-accent)); }
.pp-progress[dir="rtl"] .pp-played { background: linear-gradient(270deg, var(--pp-accent-2), var(--pp-accent)); }
.pp-abrange { background: rgba(250, 204, 21, 0.55); min-width: 3px; }
.pp-chapters { position: absolute; inset: 0; pointer-events: none; }
.pp-chapter-mark { position: absolute; top: 0; bottom: 0; width: 3px; margin-inline-start: -1px; background: rgba(0, 0, 0, 0.6); }
.pp-knob {
  position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  transform: translate(-50%, -50%) scale(0); transition: transform 0.12s ease; box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35);
}
.pp-progress[dir="rtl"] .pp-knob { transform: translate(50%, -50%) scale(0); }
.pp-progress:hover .pp-knob, .pp.pp-scrubbing .pp-knob { transform: translate(-50%, -50%) scale(1); }
.pp-progress[dir="rtl"]:hover .pp-knob, .pp.pp-scrubbing .pp-progress[dir="rtl"] .pp-knob { transform: translate(50%, -50%) scale(1); }

.pp-tip {
  position: absolute; bottom: 24px; left: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px;
  opacity: 0; pointer-events: none; transition: opacity 0.12s;
}
.pp-tip.pp-on { opacity: 1; }
.pp-thumb { width: 192px; height: 108px; border-radius: 8px; border: 2px solid rgba(255, 255, 255, 0.85); background: #000; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
.pp-tip-time, .pp-tip-chapter { background: rgba(0, 0, 0, 0.8); padding: 2px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; }
.pp-tip-time { font-variant-numeric: tabular-nums; direction: ltr; }
.pp-tip-time[data-state]:not([data-state=""])::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-inline-end: 6px; vertical-align: 1px; }
.pp-tip-time[data-state="buffered"]::before { background: #fff; }
.pp-tip-time[data-state="saved"]::before { background: #38bdf8; }
.pp-tip-chapter { max-width: 220px; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }

.pp-row { display: flex; align-items: center; height: 44px; gap: 4px; }
.pp-group { display: flex; align-items: center; gap: 2px; min-width: 0; }
.pp-spacer { flex: 1; }

.pp-btn {
  width: 40px; height: 40px; flex: none; border: 0; padding: 0; margin: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; position: relative; transition: background 0.15s, color 0.15s, transform 0.1s;
}
.pp-btn:hover { background: rgba(255, 255, 255, 0.12); }
.pp-btn:active { transform: scale(0.94); }
.pp-btn:focus-visible, .pp-mi:focus-visible, .pp-time:focus-visible { outline: 2px solid var(--pp-accent); outline-offset: 1px; }
.pp-btn[data-name="subs"].pp-active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 5px; height: 3px; border-radius: 3px; background: var(--pp-accent);
}
.pp-btn[data-name="subs"]:not(.pp-has) { opacity: 0.75; }
.pp[dir="rtl"] .pp-btn[data-name="prev"] .pp-ico, .pp[dir="rtl"] .pp-btn[data-name="next"] .pp-ico { transform: scaleX(-1); }

.pp-volume { display: flex; align-items: center; }
.pp-vol {
  -webkit-appearance: none; appearance: none; width: 0; height: 4px; margin: 0; border-radius: 4px; cursor: pointer; opacity: 0;
  background: linear-gradient(to right, #fff var(--pp-fill, 100%), rgba(255, 255, 255, 0.3) var(--pp-fill, 100%));
  transition: width 0.2s ease, opacity 0.2s, margin 0.2s;
}
.pp-volume:hover .pp-vol, .pp-vol:focus { width: 84px; opacity: 1; margin: 0 8px; }
.pp-vol::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; }

.pp-time {
  border: 0; background: none; color: #fff; font: inherit; font-size: 13px; padding: 0 8px; cursor: pointer; white-space: nowrap;
  font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; opacity: 0.92;
}

/* ------------------------------------------------------------------ menu */
.pp-menu {
  position: absolute; z-index: 10; bottom: 64px; inset-inline-end: 12px; width: 320px; max-width: calc(100% - 24px);
  max-height: calc(100% - 84px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--pp-panel); backdrop-filter: blur(18px) saturate(1.3); border: 1px solid var(--pp-line); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55); animation: pp-pop 0.16s ease;
}
@keyframes pp-pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.pp-menu-head {
  display: flex; align-items: center; gap: 6px; padding: 11px 12px; border: 0; border-bottom: 1px solid var(--pp-line);
  background: transparent; color: #fff; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; text-align: start; width: 100%;
}
.pp-menu-head.pp-static { cursor: default; padding-inline-start: 16px; }
.pp[dir="rtl"] .pp-menu-head .pp-ico, .pp[dir="rtl"] .pp-mi-nav .pp-ico { transform: scaleX(-1); }
.pp-menu-body { overflow-y: auto; padding: 6px 0; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.25) transparent; }
.pp-mi {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 7px 14px; border: 0; background: transparent;
  color: #fff; font: inherit; font-size: 14px; text-align: start; cursor: pointer;
}
button.pp-mi:hover, label.pp-mi:hover { background: rgba(255, 255, 255, 0.07); }
.pp-mi:disabled { opacity: 0.45; cursor: default; }
.pp-mi-label { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; unicode-bidi: plaintext; }
.pp-mi-label > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-mi-meta { font-size: 11.5px; opacity: 0.6; }
.pp-mi-value { opacity: 0.68; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; unicode-bidi: plaintext; }
.pp-mi-check { width: 22px; flex: none; color: var(--pp-accent); }
.pp-mi-check .pp-ico { width: 20px; height: 20px; }
.pp-mi-nav .pp-ico { width: 20px; height: 20px; opacity: 0.6; }
.pp-mi-action .pp-ico { width: 20px; height: 20px; opacity: 0.85; }
.pp-mi-range { flex-direction: column; align-items: stretch; gap: 2px; cursor: default; }
.pp-mi-rowtop { display: flex; justify-content: space-between; gap: 8px; }
.pp-mi-info { cursor: default; font-size: 13px; }
.pp-mi-info .pp-mi-value { max-width: 62%; opacity: 0.85; }
.pp-mi-note { font-size: 12px; opacity: 0.6; cursor: default; min-height: 0; padding-top: 2px; }
.pp-sep { height: 1px; background: var(--pp-line); margin: 6px 0; }

.pp-range { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; margin: 0; }
.pp-range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.25); }
.pp-range::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5.5px; border-radius: 50%; background: var(--pp-accent); border: 0; }
.pp-color { width: 38px; height: 26px; padding: 0; border: 1px solid var(--pp-line); border-radius: 6px; background: transparent; cursor: pointer; }
.pp-select, .pp-text {
  max-width: 160px; background: rgba(255, 255, 255, 0.08); color: #fff; border: 1px solid var(--pp-line); border-radius: 8px;
  padding: 5px 8px; font: inherit; font-size: 13px; outline: none;
}
.pp-select option { color: #000; }
.pp-text { flex: 1; max-width: none; user-select: text; }
.pp-mi-textrow { cursor: default; }
.pp-switch { -webkit-appearance: none; appearance: none; width: 36px; height: 20px; border-radius: 20px; background: rgba(255, 255, 255, 0.25); position: relative; cursor: pointer; transition: background 0.15s; flex: none; margin: 0; }
.pp-switch::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: inset-inline-start 0.15s; }
.pp-switch:checked { background: var(--pp-accent); }
.pp-switch:checked::after { inset-inline-start: 18px; }

/* ------------------------------------------------------------------ toast & drop */
.pp-toast { position: absolute; z-index: 12; top: 56px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; width: max-content; max-width: 90%; }
.pp-toast-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.82); border: 1px solid var(--pp-line);
  pointer-events: auto; animation: pp-pop 0.18s ease; transition: opacity 0.35s, transform 0.35s; unicode-bidi: plaintext; font-size: 13.5px;
}
.pp-toast-item.pp-out { opacity: 0; transform: translateY(-6px); }
.pp-chip { border: 0; border-radius: 999px; background: var(--pp-accent); color: #00131f; font: inherit; font-weight: 700; font-size: 12.5px; padding: 4px 12px; cursor: pointer; }

.pp-drop { position: absolute; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; background: rgba(5, 10, 20, 0.72); }
.pp.pp-dragging .pp-drop { display: flex; }
.pp-drop-inner {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 34px 44px; border: 2px dashed var(--pp-accent); border-radius: 18px;
  font-size: 17px; font-weight: 600; pointer-events: none;
}
.pp-drop-inner .pp-ico { width: 48px; height: 48px; color: var(--pp-accent); }

/* ------------------------------------------------------------------ compact */
@container (max-width: 560px) {
  .pp-btn[data-name="shot"], .pp-volume .pp-vol { display: none; }
  .pp-menu { width: calc(100% - 24px); }
}
@container (max-width: 400px) {
  .pp-btn[data-name="pip"], .pp-top-actions .pp-btn[data-name="tab"] { display: none; }
  .pp-btn { width: 34px; height: 34px; }
  .pp-time { font-size: 12px; padding: 0 4px; }
  .pp-big-play { transform: scale(0.75); }
}
@container (max-height: 260px) {
  .pp-menu { bottom: 52px; max-height: calc(100% - 60px); }
  .pp-top { display: none; }
}

/* ------------------------------------------------------------------ lite (TVs and low-end devices) */
/* Blur, shadows and animated transitions over a playing video are what slow TV GPUs down most. */
.pp.pp-lite *, .pp.pp-lite *::before, .pp.pp-lite *::after { transition: none !important; backdrop-filter: none !important; box-shadow: none !important; }
.pp.pp-lite *:not(.pp-spin) { animation: none !important; }
.pp.pp-lite .pp-menu { background: #18181c; }
.pp.pp-lite .pp-big-play { background: rgba(0, 0, 0, 0.7); }
.pp.pp-lite .pp-menu-body { scroll-behavior: auto; }

/* Remote control: the focused control must be obvious from the sofa. */
.pp.pp-tv .pp-btn:focus, .pp.pp-tv .pp-mi:focus, .pp.pp-tv .pp-time:focus, .pp.pp-tv .pp-menu-head:focus, .pp.pp-tv .pp-big-play:focus {
  outline: 3px solid #fff; outline-offset: -3px; background: rgba(56, 189, 248, 0.35);
}
.pp.pp-tv .pp-mi:focus-within { background: rgba(56, 189, 248, 0.2); }
.pp.pp-tv .pp-menu input:focus, .pp.pp-tv .pp-menu select:focus { outline: 3px solid #fff; outline-offset: 2px; }
