/* Adapted from mini-player-kit/css/player.css — มินิซีรี่เท่านั้น */

.vip-player {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  height: 100svh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: #000;
  color: #fff;
  z-index: 80;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.vip-player video.vip-player-video {
  max-width: none !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  background: #000;
  position: absolute;
  inset: 0;
}

.vip-fab[hidden],
.vip-round[hidden] {
  display: none !important;
}
.vip-fab, .vip-round {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(180deg, rgba(20,20,24,0.72), rgba(10,10,12,0.72));
  border: 1px solid rgba(255,255,255,0.24);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  cursor: pointer;
}
.vip-round { width: 40px; height: 40px; min-width: 40px; border-radius: 999px; }
.vip-fab:hover, .vip-round:hover { transform: scale(1.08); }
.vip-fab:disabled, .vip-round:disabled { opacity: 0.35; transform: none; }
.vip-fab-active {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.55);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 1px rgba(244, 63, 94, 0.25);
}
.vip-fab-rel { position: relative; }
.vip-ep-badge {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 14px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}
.vip-cc-text { font-size: 11px; font-weight: 800; letter-spacing: 0.04em; }
.vip-audio-text { font-size: 10px; font-weight: 800; letter-spacing: 0.03em; }
.vip-fab-active .vip-audio-text { color: #fda4af; }
@media (max-width: 639px) {
  .vip-fab { width: 32px; height: 32px; min-width: 32px; border-radius: 9px; }
  .vip-round { width: 36px; height: 36px; min-width: 36px; }
}

.vip-menu-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  padding: 0.75rem 0.9rem;
  text-align: left;
  font-size: 0.875rem;
  color: #f3f4f6;
  cursor: pointer;
}
.vip-menu-row:disabled { opacity: 0.4; }
.vip-menu-row.active {
  border-color: rgba(56,189,248,0.55);
  background: rgba(56,189,248,0.15);
}
.vip-muted { color: rgba(255,255,255,0.6); }

html:has(.vip-player),
body:has(.vip-player) {
  overflow: hidden;
  overscroll-behavior: none;
  margin: 0;
  background: #000;
}

.vip-close {
  position: absolute;
  left: 12px;
  top: max(0.75rem, env(safe-area-inset-top));
  z-index: 120;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(0,0,0,0.7);
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  pointer-events: auto;
  appearance: none;
}
.vip-close-icon {
  display: flex;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.vip-watermark {
  position: absolute;
  right: 12px;
  top: max(0.5rem, env(safe-area-inset-top));
  z-index: 30;
  pointer-events: none;
  padding: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  max-width: 120px;
}
.vip-watermark.vip-wm-logo {
  color: transparent;
  text-transform: none;
  font-size: 0;
  letter-spacing: 0;
}
.vip-watermark img {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  opacity: 0.92;
}
@media (min-width: 768px) {
  .vip-watermark img {
    width: 52px;
    height: 52px;
  }
}
.vip-title {
  position: absolute;
  left: 16px;
  right: 72px;
  bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  pointer-events: none;
}
.vip-title h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 1px 4px #000;
}
.vip-title p {
  margin: 4px 0 0;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
}
.vip-side {
  position: absolute;
  right: 8px;
  bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-height: min(52dvh, 22rem);
}
.vip-vol-wrap { position: relative; display: flex; align-items: center; }
.vip-vol-panel {
  position: absolute;
  right: 100%;
  bottom: 0;
  margin-right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(70vw, 18rem);
  padding: 8px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.85);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  backdrop-filter: blur(12px);
}
.vip-vol-meter { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.vip-vol-meter input { width: 100%; accent-color: #38bdf8; }
.vip-vol-pct { text-align: center; font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.7); }
.vip-ep-nav {
  position: absolute;
  left: 50%;
  bottom: calc(2.65rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  gap: 8px;
}
.vip-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 24px 12px max(0.4rem, env(safe-area-inset-bottom, 0px));
}
.vip-seek {
  position: relative;
  height: 8px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.25);
  cursor: pointer;
}
.vip-seek-buf, .vip-seek-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  pointer-events: none;
}
.vip-seek-buf { background: rgba(255,255,255,0.3); width: 0; }
.vip-seek-fill { background: #38bdf8; width: 0; }
.vip-seek-knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.vip-seek input[type=range] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.vip-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,0.7);
}
.vip-close, .vip-title, .vip-side, .vip-ep-nav, .vip-bar { transition: opacity 0.3s ease; }
.vip-hidden { opacity: 0; pointer-events: none; }
.vip-chrome { transition: opacity 0.3s ease; }
.vip-surface {
  position: absolute;
  inset: 0;
  z-index: 10;
  touch-action: none;
}
.vip-preload {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.vip-cc-dot {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: #fb7185;
  transform: translateX(-50%);
}
.vip-cue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}
.vip-cue span {
  max-width: 34em;
  text-align: center;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
  white-space: pre-line;
  text-shadow: 0 1px 4px rgba(0,0,0,.95), 0 0 8px rgba(0,0,0,.85);
  font-size: clamp(15px, 4.5vw, 20px);
}
.vip-flash, .vip-ep-flash {
  position: absolute;
  top: 50%;
  z-index: 30;
  transform: translateY(-50%);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  pointer-events: none;
}
.vip-flash { background: rgba(0,0,0,0.55); backdrop-filter: blur(8px); }
.vip-flash.back { left: 24px; }
.vip-flash.fwd { right: 24px; }
.vip-ep-flash {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 61, 110, 0.9);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.vip-ep-flash.prev { left: 20px; }
.vip-ep-flash.next { right: 20px; }
.vip-next-hint {
  position: absolute;
  left: 50%;
  top: 64px;
  z-index: 30;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 61, 110, 0.9);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  pointer-events: none;
}
.vip-spin {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  color: rgba(255,255,255,0.8);
  font-size: 14px;
}
.vip-spinner {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #38bdf8;
  animation: vip-spin 0.8s linear infinite;
}
@keyframes vip-spin { to { transform: rotate(360deg); } }
.vip-backdrop {
  position: absolute;
  inset: 0;
  z-index: 45;
  border: 0;
  background: rgba(0,0,0,0.55);
  cursor: pointer;
}
.vip-ep-free {
  position: absolute;
  left: 2px;
  top: 2px;
  border-radius: 3px;
  background: #10b981;
  padding: 0 2px;
  font-size: 8px;
  font-weight: 800;
  line-height: 12px;
}
.vip-error {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0,0,0,0.8);
  padding: 24px;
  text-align: center;
}
.vip-error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.vip-error-actions button, .vip-done button {
  border-radius: 999px;
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.vip-done-title { margin: 0; font-size: 20px; font-weight: 800; }
.vip-done-sub { margin: 8px 0 16px; max-width: 24rem; font-size: 14px; color: rgba(255,255,255,0.7); }
@media (min-width: 640px) {
  .vip-side { right: 32px; bottom: 10rem; max-height: none; gap: 6px; }
  .vip-ep-nav { left: auto; right: 32px; bottom: 7rem; transform: none; }
  .vip-title { left: 40px; right: 96px; bottom: 8rem; }
  .vip-bar { padding: 40px 48px max(1.25rem, env(safe-area-inset-bottom)); }
  .vip-cue { bottom: 8rem; }
}
.vip-sheet {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(340px, 85vw);
  background: linear-gradient(180deg, rgba(20,20,28,0.95), rgba(12,12,18,0.97));
  border-left: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
  z-index: 90;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}
.vip-sheet:not([hidden]) { display: flex; }
.vip-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.vip-sheet-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.vip-sheet-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}
.vip-sheet-close {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.7);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.vip-ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
  align-content: start;
}
.vip-ep-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  pointer-events: auto;
}
.vip-ep-btn:hover { border-color: rgba(255,255,255,0.4); }
.vip-ep-btn.active {
  border-color: #e879f9;
  background: rgba(217, 70, 239, 0.25);
  box-shadow: 0 0 0 2px rgba(255, 79, 209, 0.25);
}
.vip-vol-panel[hidden],
.vip-sheet[hidden],
.vip-done[hidden],
.vip-error[hidden],
.vip-spin[hidden],
.vip-cue[hidden],
.vip-flash[hidden],
.vip-ep-flash[hidden],
.vip-next-hint[hidden],
.vip-backdrop[hidden],
.vip-cc-dot[hidden],
.vip-resume-chip[hidden],
.vip-play-center[hidden],
.vip-player[hidden],
.vip-cast[hidden] {
  display: none !important;
}
.vip-resume-chip {
  position: absolute;
  left: 50%;
  top: 64px;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(0,0,0,0.75);
  color: #7dd3fc;
  font-weight: 600;
  font-size: 12px;
  backdrop-filter: blur(8px);
}
.vip-resume-chip button {
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  cursor: pointer;
}
.vip-done {
  position: absolute;
  inset: 0;
  z-index: 46;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  text-align: center;
  padding: 24px;
}
.vip-play-center {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 35;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 0;
  background: rgba(255,255,255,0.2);
  color: #fff;
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.vip-fab.is-cast-on {
  color: #5eead4;
  border-color: rgba(45, 212, 191, 0.7);
}
.vip-cast {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  padding: 16px;
}
.vip-cast-card {
  width: min(420px, 100%);
  margin-bottom: 8px;
  border-radius: 16px;
  background: #12141a;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 16px 16px 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
}
.vip-cast-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.vip-cast-brand { margin: 0; font-size: 16px; font-weight: 700; }
.vip-cast-sub { margin: 2px 0 0; color: rgba(255,255,255,0.62); font-size: 13px; }
.vip-cast-x {
  width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; color: #fff; font-size: 22px; cursor: pointer;
}
.vip-cast-label { display: block; margin: 14px 0 8px; font-size: 13px; color: rgba(255,255,255,0.78); }
.vip-cast-code {
  width: 100%; box-sizing: border-box; text-align: center; letter-spacing: 0.35em;
  font-size: 22px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.16); background: #0b0d12; color: #fff;
}
.vip-cast-send, .vip-cast-controls button, .vip-cast-disconnect {
  border: 0; border-radius: 10px; cursor: pointer; color: #fff;
}
.vip-cast-send {
  width: 100%; margin-top: 10px; padding: 12px; font-weight: 700;
  background: #0f766e;
}
.vip-cast-status { min-height: 1.2em; margin: 8px 0 0; font-size: 13px; color: #99f6e4; }
.vip-cast-status.is-error { color: #fda4af; }
.vip-cast-controls { display: flex; gap: 8px; margin-top: 12px; }
.vip-cast-controls button {
  flex: 1; padding: 8px; background: rgba(255,255,255,0.08);
}
.vip-cast-disconnect {
  width: 100%; margin-top: 8px; padding: 8px; background: transparent; color: #fda4af;
}
