.q-video-dialog {
  --q-video-width: min(90vw, 420px, max(200px, calc((100svh - 152px) * .5625)));
  position: fixed;
  inset: 0;
  width: var(--q-video-width);
  max-width: none;
  max-height: calc(100svh - 32px);
  margin: auto;
  padding: 46px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f3f3f7;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.q-video-dialog[open] { animation: q-video-appear .24s cubic-bezier(.2, .75, .3, 1) both; }
.q-video-dialog::-webkit-scrollbar { display: none; }
.q-video-dialog::backdrop { background: #030509ed; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.q-video-dialog [hidden] { display: none !important; }
.q-video-dialog__title { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.q-video-dialog__close {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #ffffff24;
  border-radius: 50%;
  background: #ffffff09;
  color: #f3f3f7;
  cursor: pointer;
  transition: background .18s, border-color .18s;
  z-index: 2;
}
.q-video-dialog__close svg { width: 18px; height: 18px; }
.q-video-dialog__close svg,.q-video-control svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.q-video-control .q-control-play { fill: currentColor; stroke: none; }
.q-video-dialog__close:hover { background: #ffffff17; border-color: #ffffff4d; }
.q-video-dialog__close:focus-visible { outline-offset: -3px; }

.q-video-dialog__player {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 9 / 16;
  flex: none;
  overflow: hidden;
  border-radius: 14px;
  background: #090a0d;
}
.q-video-dialog__player iframe,
.q-video-dialog__player video { display: block; width: 100%; height: 100%; max-width: none; max-height: none; aspect-ratio: 9 / 16; border: 0; object-fit: contain; background: #000; }
.q-video-dialog[data-state="loading"] .q-video-dialog__player::after { content: ""; position: absolute; inset: 0; width: 26px; height: 26px; margin: auto; border: 2px solid #ffffff26; border-top-color: #fff; border-radius: 50%; pointer-events: none; animation: q-video-loading .8s linear infinite; }

.q-video-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 4px 0 0;
  color: #eceef3;
}
.q-video-control { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; transition: color .18s, background .18s; }
.q-video-control svg { width: 18px; height: 18px; }
.q-video-control:hover { color: #fff; background: #ffffff12; }
.q-video-control:focus-visible { outline-offset: -2px; }
.q-video-control:disabled { opacity: .35; cursor: default; }
.q-video-controls .q-control-pause,
.q-video-controls .q-control-muted { display: none; }
.q-video-controls[data-playing="true"] .q-control-play,
.q-video-controls[data-muted="true"] .q-control-sound { display: none; }
.q-video-controls[data-playing="true"] .q-control-pause,
.q-video-controls[data-muted="true"] .q-control-muted { display: block; }
.q-video-time { flex: none; min-width: 3ch; font-size: 11px; line-height: 1; font-variant-numeric: tabular-nums; color: #aeb2bd; }

.q-video-seek { --q-video-progress: 0%; appearance: none; -webkit-appearance: none; flex: 1 1 0; min-width: 24px; width: 100%; height: 26px; margin: 0; padding: 0; border: 0; background: transparent; cursor: pointer; accent-color: #fff; }
.q-video-seek::-webkit-slider-runnable-track { height: 3px; border: 0; border-radius: 3px; background: linear-gradient(to right, #f3f3f7 var(--q-video-progress), #ffffff38 var(--q-video-progress)); }
.q-video-seek::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 9px; height: 9px; margin-top: -3px; border: 0; border-radius: 50%; background: #fff; }
.q-video-seek::-moz-range-track { height: 3px; border: 0; border-radius: 3px; background: linear-gradient(to right, #f3f3f7 var(--q-video-progress), #ffffff38 var(--q-video-progress)); }
.q-video-seek::-moz-range-thumb { width: 9px; height: 9px; border: 0; border-radius: 50%; background: #fff; }
.q-video-seek:focus-visible { outline: 2px solid var(--q-accent, #c592ff); outline-offset: 3px; border-radius: 4px; }
.q-video-seek:disabled { opacity: .35; cursor: default; }

.q-video-dialog__status { margin: 10px 0 0; font-size: 12px; line-height: 1.6; text-align: center; color: #aeb2bd; }
.q-video-dialog__status:empty { display: none; }
.q-video-dialog__fallback { display: flex; align-items: center; justify-content: center; min-height: 36px; margin-top: 5px; font-size: 12px; line-height: 1.5; text-underline-offset: 4px; color: #eff1f5; }

.q-video-stage:fullscreen {
  --q-video-width: min(calc(100vw - 32px), 720px, calc((100svh - 104px) * .5625));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100svh;
  max-height: none;
  padding: 40px 16px 16px;
  background: #030509;
  overflow: hidden;
  animation: none;
}
.q-video-stage:fullscreen .q-video-dialog__player,
.q-video-stage:fullscreen .q-video-controls { width: var(--q-video-width); }
.q-video-stage:fullscreen .q-video-dialog__close { position: fixed; top: 12px; right: 12px; }
.q-video-stage:fullscreen .q-video-dialog__player { border-radius: 8px; }

@media (max-width: 480px) {
  .q-video-controls { gap: 7px; }
  .q-video-dialog__player { border-radius: 12px; }
}
@media (max-height: 460px) {
  .q-video-dialog { --q-video-width: min(88vw, 200px); padding-top: 42px; }
  .q-video-dialog__player { aspect-ratio: auto; height: max(200px, calc(100svh - 144px)); }
  .q-video-dialog__player iframe,
  .q-video-dialog__player video { aspect-ratio: auto; }
  .q-video-stage:fullscreen { --q-video-width: min(calc(100vw - 32px), 300px); padding-top: 40px; overflow: auto; justify-content: flex-start; }
  .q-video-stage:fullscreen .q-video-dialog__player { height: max(200px, calc(100svh - 104px)); }
  .q-video-controls { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .q-video-dialog[open], .q-video-dialog[data-state="loading"] .q-video-dialog__player::after { animation: none; }
  .q-video-dialog__close, .q-video-control { transition: none; }
}
@media (forced-colors: active) {
  .q-video-dialog { color: CanvasText; }
  .q-video-dialog__close, .q-video-control { color: ButtonText; background: ButtonFace; border: 1px solid ButtonText; }
  .q-video-dialog__status, .q-video-dialog__fallback, .q-video-time { color: CanvasText; }
  .q-video-seek { appearance: auto; -webkit-appearance: auto; accent-color: auto; }
}
@keyframes q-video-appear { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes q-video-loading { to { transform: rotate(360deg); } }
