#ezModal {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100;
  overflow: hidden;
  --aw: 90%;
  --ah: 45%;
}
#ezModal.abierto { display: block; }
#ezModal video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
}

.ez-barra {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: calc(14px + env(safe-area-inset-top)) 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(0,0,0,0.65), transparent);
  z-index: 3;
}
.ez-titulo { color: #fff; font-size: 16px; font-weight: 700; }
#ezModal .ez-cerrar {
  width: 40px; height: 40px; min-width: 0;
  margin: 0; padding: 0;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,0.18) !important;
  backdrop-filter: blur(8px);
  color: #fff !important;
  display: grid; place-items: center;
}
.ez-cerrar svg { width: 20px; height: 20px; }

.ez-rafaga {
  position: absolute;
  top: calc(66px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  padding: 8px 16px;
  border-radius: 999px;
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 3;
}
.ez-rafaga.visible { display: flex; }
.ez-rafaga-lbl { color: #fff; font-size: 13px; font-weight: 600; }
.ez-sw { position: relative; display: inline-block; width: 44px; height: 24px; }
.ez-sw input { opacity: 0; width: 0; height: 0; }
.ez-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #ccc; transition: .2s; border-radius: 24px;
}
.ez-slider:before {
  position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; transition: .2s; border-radius: 50%;
}
.ez-sw input:checked + .ez-slider { background: #10B981; }
.ez-sw input:checked + .ez-slider:before { transform: translateX(20px); }

.ez-flash {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: transparent; transition: background 150ms;
}
.ez-flash.verde { background: rgba(16, 185, 129, 0.4); }
.ez-flash.rojo { background: rgba(220, 38, 38, 0.4); }

.ez-marco {
  position: absolute;
  left: 50%; top: 42%;
  width: var(--aw); height: var(--ah);
  transform: translate(-50%, -50%);
  border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  transition: width 0.15s ease, height 0.15s ease;
  z-index: 2;
}
.ez-esq {
  position: absolute;
  width: 28px; height: 28px;
  border: 4px solid #00E676;
  transition: border-color 0.2s;
}
.ez-marco.ok .ez-esq { border-color: #40C4FF; }
.ez-esq.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 18px; }
.ez-esq.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 18px; }
.ez-esq.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 18px; }
.ez-esq.br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 18px; }

.ez-linea {
  position: absolute;
  left: 8px; right: 8px; top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00E676, transparent);
  box-shadow: 0 0 12px #00E676;
  animation: ezEscanear 2s ease-in-out infinite;
}
@keyframes ezEscanear {
  0%, 100% { top: 6%; opacity: 0.4; }
  50% { top: 94%; opacity: 1; }
}

.ez-panel {
  position: absolute;
  left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(15, 22, 40, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 3;
}
.ez-info { color: #fff; font-size: 13px; font-weight: 600; text-align: center; margin-bottom: 12px; }
.ez-ctrl { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.ez-ctrl-label { color: rgba(255,255,255,0.75); font-size: 12px; font-weight: 700; width: 38px; }
.ez-ctrl-val { color: #fff; font-size: 12px; font-weight: 700; width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.ez-ctrl input[type="range"] {
  flex: 1; height: 28px; margin: 0; padding: 0;
  border: none; background: transparent; accent-color: #00E676;
}
#ezModal .ez-reiniciar {
  width: 100%; margin: 12px 0 0; padding: 10px;
  border: none; border-radius: 12px;
  background: rgba(255,255,255,0.14) !important;
  color: #fff !important;
  font-size: 13px; font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .ez-linea { animation: none; top: 50%; }
}