/* meow player (used by index.html and watch.html) */
body.mp-open { overflow: hidden; }

.mp {
  --mp-accent: var(--primary-color, #e50914);
  --mp-green: #46d369;
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: #000;
  color: #fff;
  font-family: var(--font-body, 'Montserrat', system-ui, sans-serif);
  font-size: 14px;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}
.mp[hidden] { display: none; }
.mp:not(.ui-on) { cursor: none; }
.mp button { font-family: inherit; }

.mp-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

/* ---------- subtitles (drawn by us, so they stay in sync after seeking) ---------- */
.mp { --sub: clamp(17px, 2.5vw, 44px); }
.mp[data-subsize="s"] { --sub: clamp(14px, 2vw, 34px); }
.mp[data-subsize="l"] { --sub: clamp(21px, 3.3vw, 58px); }
.mp-subs {
  position: absolute;
  left: 0; right: 0;
  bottom: 6%;
  padding: 0 8%;
  text-align: center;
  pointer-events: none;
  transition: bottom 0.28s ease;
}
.mp.ui-on .mp-subs { bottom: 17%; }
.mp-subs-inner {
  display: inline-block;
  max-width: 100%;
  font-size: var(--sub);
  line-height: 1.32;
  font-weight: 600;
  color: #fff;
  opacity: 0;
  transition: opacity 0.08s;
  white-space: pre-wrap;
}
.mp-subs.has-text .mp-subs-inner { opacity: 1; }
.mp[data-subbg="shadow"] .mp-subs-inner,
.mp:not([data-subbg]) .mp-subs-inner {
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 1px 6px rgba(0, 0, 0, 0.95), 0 0 12px rgba(0, 0, 0, 0.7);
}
.mp[data-subbg="box"] .mp-subs-inner {
  background: rgba(0, 0, 0, 0.72);
  padding: 0.12em 0.55em 0.18em;
  border-radius: 8px;
  box-decoration-break: clone;
}

/* ---------- feedback overlays ---------- */
.mp-flash {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translate(-50%, -6px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(18, 18, 20, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  max-width: 88vw;
}
.mp-flash span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-flash.show { animation: mp-flash 1.9s ease forwards; }
@keyframes mp-flash {
  0% { opacity: 0; transform: translate(-50%, -8px); }
  10%, 75% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -4px); }
}

.mp-ripple {
  position: absolute;
  top: 0; bottom: 0;
  width: 34%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  opacity: 0;
  pointer-events: none;
  font-weight: 600;
  z-index: 4;
}
.mp-ripple i { font-size: 26px; }
.mp-ripple-l { left: 0; border-radius: 0 60% 60% 0 / 0 50% 50% 0; }
.mp-ripple-r { right: 0; border-radius: 60% 0 0 60% / 50% 0 0 50%; }
.mp-ripple.show { animation: mp-ripple 0.65s ease-out forwards; }
@keyframes mp-ripple { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }

.mp-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: none;
  z-index: 5;
}
.mp-spinner[hidden], .mp-error[hidden], .mp-modal[hidden] { display: none; }
.mp-ring {
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--mp-accent);
  animation: mp-spin 0.85s linear infinite;
}
.mp-spinner-text { font-weight: 600; text-shadow: 0 1px 6px #000; min-height: 1.2em; }
@keyframes mp-spin { to { transform: rotate(360deg); } }

.mp-error {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: rgba(0, 0, 0, 0.78);
}
.mp-error > i { font-size: 38px; color: #f0ad4e; }
.mp-error-text { max-width: 440px; color: #ddd; line-height: 1.5; }

.mp-solid {
  background: var(--mp-accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 11px 24px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s;
}
.mp-solid:hover { filter: brightness(1.12); transform: translateY(-1px); }

/* ---------- controls layer ---------- */
.mp-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 7;
}
.mp:not(.ui-on) .mp-ui { opacity: 0; }
.mp:not(.ui-on) .mp-ui * { pointer-events: none !important; }
.mp:not(.paused) .mp-bigplay { opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(0.8); }
.mp-top, .mp-bottom { pointer-events: auto; }

.mp-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 26px 60px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.78), transparent);
}
.mp-titles { min-width: 0; }
.mp-title { font-family: var(--font-title, inherit); font-size: 18px; font-weight: 700; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-subtitle { font-size: 13px; color: #cfcfcf; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mp-bigplay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 84px; height: 84px;
  border-radius: 50%;
  border: 0;
  background: rgba(229, 9, 20, 0.92);
  color: #fff;
  font-size: 30px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 10px 40px rgba(229, 9, 20, 0.45);
  transition: transform 0.2s, opacity 0.2s;
}
.mp-bigplay i { margin-left: 4px; }
.mp-bigplay:hover { transform: translate(-50%, -50%) scale(1.08); }
.mp-bigplay .fa-pause { margin-left: 0; }

.mp-bottom {
  padding: 60px 22px 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.55) 55%, transparent);
}
.mp-row { display: flex; align-items: center; gap: 2px; }
.mp-spacer { flex: 1; }

.mp-icon {
  position: relative;
  min-width: 42px; height: 42px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.mp-icon:hover { background: rgba(255, 255, 255, 0.14); }
.mp-icon:active { transform: scale(0.92); }
.mp-icon:focus-visible, .mp-item:focus-visible, .mp-seek:focus-visible { outline: 2px solid var(--mp-accent); outline-offset: 2px; }
.mp-icon.open, .mp-icon.on { color: var(--mp-accent); }
.mp-icon[hidden], .mp-menu-wrap[hidden] { display: none; }

.mp-skip b { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); font-size: 8.5px; font-weight: 800; letter-spacing: -0.2px; pointer-events: none; }

.mp-vol { display: flex; align-items: center; }
.mp-vol-slider {
  width: 0; opacity: 0;
  transition: width 0.2s ease, opacity 0.2s, margin 0.2s;
  accent-color: var(--mp-accent);
  cursor: pointer;
  height: 4px;
}
.mp-vol:hover .mp-vol-slider, .mp-vol:focus-within .mp-vol-slider { width: 86px; opacity: 1; margin: 0 8px 0 2px; }

.mp-time { font-variant-numeric: tabular-nums; font-weight: 600; margin-left: 8px; white-space: nowrap; }
.mp-of { color: #a5a5a5; }
.mp-mini-spin { position: absolute; right: 5px; top: 5px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: var(--mp-accent); animation: mp-spin 0.7s linear infinite; }
.mp-mini-spin[hidden] { display: none; }
.mp-subs-btn.loading i { opacity: 0.55; }

/* ---------- seek bar ---------- */
.mp-seek {
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  margin: 0 4px 2px;
}
.mp-seek-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.26);
  transition: height 0.12s ease;
}
.mp-seek:hover .mp-seek-track, .mp.scrubbing .mp-seek-track { height: 8px; }
.mp-seek-track > div { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; pointer-events: none; }
.mp-seek-buf { background: rgba(255, 255, 255, 0.34); width: 0; }
.mp-seek-hover { background: rgba(255, 255, 255, 0.28); width: 0; }
.mp-seek-played { background: var(--mp-accent); width: 0; box-shadow: 0 0 12px rgba(229, 9, 20, 0.6); }
.mp-seek-thumb {
  top: 50% !important; bottom: auto !important;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50% !important;
  background: #fff;
  transform: scale(0);
  transition: transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.mp-seek:hover .mp-seek-thumb, .mp.scrubbing .mp-seek-thumb { transform: scale(1); }
.mp-seek-tip {
  position: absolute;
  bottom: 30px;
  transform: translateX(-50%);
  padding: 4px 9px;
  border-radius: 7px;
  background: rgba(15, 15, 17, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  white-space: nowrap;
}
.mp-seek:hover .mp-seek-tip, .mp.scrubbing .mp-seek-tip { opacity: 1; }

/* ---------- menus ---------- */
.mp-menu-wrap { position: relative; }
.mp-menu {
  position: absolute;
  bottom: calc(100% + 14px);
  right: -6px;
  width: 300px;
  max-width: 88vw;
  max-height: min(64vh, 480px);
  overflow-y: auto;
  padding: 8px;
  border-radius: 14px;
  background: rgba(20, 20, 23, 0.95);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7);
  animation: mp-menu-in 0.16s ease;
  z-index: 9;
}
.mp-menu[hidden] { display: none; }
@keyframes mp-menu-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.mp-menu::-webkit-scrollbar { width: 6px; }
.mp-menu::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 3px; }
.mp-menu-head { padding: 10px 10px 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.9px; text-transform: uppercase; color: #8d8d92; }
.mp-menu-empty { padding: 12px 10px; color: #9a9a9f; font-size: 13px; }
.mp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #ececee;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.mp-item:hover { background: rgba(255, 255, 255, 0.1); }
.mp-item .mp-tick { width: 14px; font-size: 12px; color: var(--mp-accent); opacity: 0; }
.mp-item.active .mp-tick, .mp-item .mp-tick.show { opacity: 1; }
.mp-item.active { font-weight: 700; }
.mp-item-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-item-detail { font-size: 12px; color: #92929a; white-space: nowrap; max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
.mp-item.disabled { opacity: 0.45; cursor: not-allowed; }
.mp-item-upload { margin-top: 4px; color: #bdbdc2; border-top: 1px solid rgba(255, 255, 255, 0.07); border-radius: 0 0 9px 9px; }
.mp-item-upload .mp-tick { color: #bdbdc2; }

.mp-seg { display: flex; align-items: center; gap: 6px; padding: 4px 6px 8px; }
.mp-seg button {
  flex: 1;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #ececee;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.mp-seg button:hover { background: rgba(255, 255, 255, 0.13); }
.mp-seg button.active { border-color: var(--mp-accent); background: rgba(229, 9, 20, 0.18); }
.mp-seg button.wide { flex: 1.5; font-size: 12px; }
.mp-sync-readout { min-width: 52px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- share button: icon morph + ring + "Link copied!" chip ---------- */
.mp-share { padding: 0 14px; font-size: 16px; }
.mp-share-label { font-size: 13px; font-weight: 700; }
.mp-share-icons { position: relative; width: 18px; height: 18px; display: inline-block; }
.mp-share-icons i {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
}
.mp-share-icons i:last-child { opacity: 0; transform: scale(0.2) rotate(-100deg); color: var(--mp-green); }
.mp-share.busy .mp-share-icons i:first-child { animation: mp-spin 0.8s linear infinite; }
.mp-share.done { color: var(--mp-green); background: rgba(70, 211, 105, 0.16); animation: mp-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.mp-share.done .mp-share-icons i:first-child { opacity: 0; transform: scale(0.2) rotate(100deg); }
.mp-share.done .mp-share-icons i:last-child { opacity: 1; transform: scale(1) rotate(0); }
.mp-share.done::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  border: 2px solid var(--mp-green);
  animation: mp-ring 0.75s ease-out forwards;
  pointer-events: none;
}
@keyframes mp-pop { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes mp-ring { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(1.7); } }
.mp-copied {
  position: absolute;
  bottom: calc(100% + 16px);
  left: 50%;
  transform: translate(-50%, 10px) scale(0.85);
  opacity: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--mp-green);
  color: #06260f;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 8px 26px rgba(70, 211, 105, 0.38);
}
.mp-copied::after { content: ''; position: absolute; left: 50%; top: 100%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--mp-green); }
.mp-copied.show { animation: mp-chip 2.4s ease forwards; }
@keyframes mp-chip {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.8); }
  12% { opacity: 1; transform: translate(-50%, -2px) scale(1.06); }
  20% { transform: translate(-50%, 0) scale(1); }
  84% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -6px) scale(0.98); }
}

/* clipboard-blocked fallback */
.mp-modal { position: absolute; inset: 0; z-index: 12; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.7); }
.mp-modal-card { width: min(440px, 90vw); padding: 24px; border-radius: 16px; background: #1b1b1f; border: 1px solid rgba(255, 255, 255, 0.1); display: flex; flex-direction: column; gap: 14px; }
.mp-modal-input { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(255, 255, 255, 0.06); color: #fff; font-size: 14px; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .mp-top { padding: 12px 14px 40px; }
  .mp-title { font-size: 15px; }
  .mp-bottom { padding: 40px 10px 8px; }
  .mp-icon { min-width: 38px; height: 38px; padding: 0 7px; font-size: 16px; }
  .mp-vol { display: none; }
  .mp-share-label { display: none; }
  .mp-time { margin-left: 4px; font-size: 12px; }
  .mp-menu { position: fixed; left: 12px; right: 12px; bottom: 74px; width: auto; max-width: none; }
  .mp-bigplay { width: 68px; height: 68px; font-size: 24px; }
  .mp.ui-on .mp-subs { bottom: 24%; }
  .mp-pip, .mp-speed-btn, .mp-vr { display: none; }
  .mp-speed-btn ~ .mp-menu, .mp-menu-wrap:has(.mp-speed-btn) { display: none; }
  .mp-icon { min-width: 36px; padding: 0 6px; }
}
/* Reduced motion: no sliding/zooming, but transient feedback ("Link copied!", "+10s") must still appear.
   (Squashing every animation to ~0ms would skip straight to their invisible end state.) */
@media (prefers-reduced-motion: reduce) {
  .mp *, .mp *::before, .mp *::after { transition-duration: 0.01ms !important; }
  .mp-menu, .mp-share.done { animation: none !important; }
  .mp-share.done::after { animation: none !important; opacity: 0; }
  .mp-flash.show, .mp-copied.show { animation: mp-hold 2.2s linear forwards; }
  .mp-ripple.show { animation: mp-hold-plain 0.6s linear forwards; }
}
@keyframes mp-hold { 0%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } }
@keyframes mp-hold-plain { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

.mp-audio-btn.single { opacity: 0.75; }

/* share button while the link-preview video is being prepared */
.mp-share.preparing { color: #ffd166; }
.mp-share.preparing .mp-share-label { display: inline !important; }
.mp-share.preparing .mp-share-icons i:first-child { animation: mp-spin 1.4s linear infinite; }
