/* ROOT */

.vp-root {
  --vp-accent: #2f8fff;
  --vp-surface: #1c1c20;
  position: relative;
  background-color: #000;
  background-image: var(--vp-poster, none);
  background-size: cover;
  background-position: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  line-height: 0;
  user-select: none;
  -webkit-user-select: none;
  border-radius: var(--radius, 10px);
}

@media (max-width: 900px) {
  .vp-root { border-radius: 0; }
}

.vp-root video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.vp-root.is-ended video {
  opacity: 0;
}

.vp-error {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: #fff;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.6);
}

.vp-root.has-error .vp-error { display: grid; }


/* CONTROLS */

.vp-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px 0 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.6) 60%, rgba(0, 0, 0, 0) 100%);
  color: #fff;
  font: 500 13px/1 Arial, Helvetica, sans-serif;
  box-sizing: border-box;
}

.vp-btn {
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 12px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  line-height: 0;
  transition: color 0.15s;
  flex-shrink: 0;
}

.vp-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.vp-btn svg { width: 20px; height: 20px; fill: currentColor; }

.vp-play { padding: 8px 18px; }
.vp-play svg { width: 32px; height: 32px; }

.vp-play .vp-i-pause { display: none; }
.vp-root.is-playing .vp-play .vp-i-play { display: none; }
.vp-root.is-playing .vp-play .vp-i-pause { display: inline; }

.vp-time {
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: left;
  padding: 0 2px;
  opacity: 0.95;
  flex-shrink: 0;
}


/* PROGRESS */

.vp-progress {
  --vp-progress: 0;
  position: relative;
  flex: 1 1 auto;
  height: 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.vp-progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.vp-progress-fill {
  height: 100%;
  width: 100%;
  background: #fff;
  border-radius: 2px;
  transform: scaleX(var(--vp-progress, 0));
  transform-origin: left center;
  transition: background 0.15s;
  will-change: transform;
}

.vp-progress-thumb {
  position: absolute;
  top: 50%;
  left: calc(var(--vp-progress, 0) * 100%);
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: background 0.15s;
}


/* MENU */

.vp-menu-panel {
  position: absolute;
  right: 6px;
  bottom: 100%;
  margin-bottom: 4px;
  min-width: 220px;
  max-width: calc(100% - 12px);
  background: var(--vp-surface);
  color: #fff;
  border-radius: 10px;
  padding: 6px 14px;
  font: 500 14px/1.3 Arial, Helvetica, sans-serif;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transform-origin: bottom right;
  visibility: hidden;
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.12s;
  pointer-events: none;
}

.vp-menu-panel.is-open {
  opacity: 1;
  transform: none;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s;
}

.vp-menu-section {
  padding: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.vp-menu-section + .vp-menu-section {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.vp-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  cursor: pointer;
}

.vp-menu-text {
  flex: 1 1 auto;
  text-align: left;
}

.vp-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  font: 500 14px/1 Arial, Helvetica, sans-serif;
  padding: 0;
  gap: 12px;
  text-align: left;
  transition: color 0.12s;
}

.vp-menu-item:focus-visible { outline: 2px solid #fff; outline-offset: 1px; border-radius: 4px; }
.vp-menu-item svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }


/* SPEED PICKER */

.vp-speed-picker {
  display: flex;
  gap: 4px;
  width: 100%;
}

.vp-speed-opt {
  position: relative;
  flex: 1 1 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 0;
  padding: 8px 0;
  border-radius: 6px;
  cursor: pointer;
  font: 500 13px/1 Arial, Helvetica, sans-serif;
  transition: background 0.12s, color 0.12s;
}

.vp-speed-opt::before {
  content: "";
  position: absolute;
  inset: -8px 0;
}

.vp-speed-opt[aria-pressed="true"] {
  background: var(--vp-accent);
  color: #fff;
}

.vp-speed-opt:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }


/* SWITCH */

.vp-switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.25);
  border: 0;
  cursor: pointer;
  transition: background 0.15s;
  padding: 0;
  flex-shrink: 0;
}

.vp-switch::before {
  content: "";
  position: absolute;
  inset: -11px -2px;
}

.vp-switch[aria-checked="true"] { background: var(--vp-accent); }

.vp-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.vp-switch[aria-checked="true"] .vp-switch-thumb { transform: translateX(18px); }
.vp-switch:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }


/* TOUCH */

@media (pointer: coarse) {
  .vp-progress { height: 44px; }
}


/* HOVER */

@media (hover: hover) {
  .vp-btn:hover         { color: var(--vp-accent); }
  .vp-menu-item:hover   { color: var(--vp-accent); }
  .vp-speed-opt:hover                       { background: rgba(255, 255, 255, 0.18); }
  .vp-speed-opt[aria-pressed="true"]:hover  { background: var(--vp-accent); }
  .vp-progress:hover .vp-progress-fill,
  .vp-progress:hover .vp-progress-thumb     { background: var(--vp-accent); }
}
